diff --git a/uwb/aidl/Android.bp b/uwb/aidl/Android.bp index 0d1ebc23f3..a1a66e5a2a 100755 --- a/uwb/aidl/Android.bp +++ b/uwb/aidl/Android.bp @@ -53,9 +53,6 @@ aidl_interface { ], }, ndk: { - vndk: { - enabled: true, - }, apex_available: [ "//apex_available:platform", "com.android.uwb", diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl new file mode 100644 index 0000000000..774133e3df --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbAndroidCapabilities.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="long") @VintfStability +enum UwbAndroidCapabilities { + POWER_STATS_QUERY = 1, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwbChip.aidl b/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwbChip.aidl index 7074753c91..c4cb47b07b 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwbChip.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb/current/android/hardware/uwb/IUwbChip.aidl @@ -40,6 +40,7 @@ interface IUwbChip { void open(in android.hardware.uwb.IUwbClientCallback clientCallback); void close(); void coreInit(); - int getSupportedVendorUciVersion(); + int getSupportedAndroidUciVersion(); + long getSupportedAndroidCapabilities(); int sendUciMessage(in byte[] data); } diff --git a/uwb/aidl/android/hardware/uwb/IUwbChip.aidl b/uwb/aidl/android/hardware/uwb/IUwbChip.aidl old mode 100755 new mode 100644 index 9530af4471..0c986116aa --- a/uwb/aidl/android/hardware/uwb/IUwbChip.aidl +++ b/uwb/aidl/android/hardware/uwb/IUwbChip.aidl @@ -49,14 +49,24 @@ interface IUwbChip { */ void coreInit(); - /** - * Supported version of vendor UCI specification. - * - * This corresponds to the version of the "android.hardware.uwb.fira_android" types-only - * package included in the HAL implementation. This vendor params/commands package will be - * updated on a different cadence to the main UWB HAL interface package. - */ - int getSupportedVendorUciVersion(); + /** + * Supported version of vendor UCI specification. + * + * @return Returns the version of the "android.hardware.uwb.fira_android" types-only + * package included in the HAL implementation. This vendor params/commands package will be + * updated on a different cadence to the main UWB HAL interface package. + */ + int getSupportedAndroidUciVersion(); + + /** + * Mechanism to allow HAL implementation to optionally expose features that are defined + * in the "android.hardware.uwb.fira_android" types-only package. + * + * @return Returns the bitmask of capabilities + * (android.hardware.uwb.fira_android.UwbAndroidCapabilities) that is supported by the + * HAL implementation. + */ + long getSupportedAndroidCapabilities(); /** * Write the UCI message to the UWB Subsystem. diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbAndroidCapabilities.aidl new file mode 100644 index 0000000000..3486d5a078 --- /dev/null +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbAndroidCapabilities.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.uwb.fira_android; + +/** + * Android specific capabilities should be defined here. + * + * For any features enabled via the FIRA vendor commands for Android, use this bitmask + * to allow devices to expose the features supported by the HAL implementation. + * + */ +@VintfStability +@Backing(type="long") +enum UwbAndroidCapabilities { + /** TODO: Change the name if necessary when the corresponding vendor commands are added */ + POWER_STATS_QUERY = 0x1, +} diff --git a/uwb/aidl/default/uwb_chip.cpp b/uwb/aidl/default/uwb_chip.cpp index fe64fa7125..10dbdb6e5b 100644 --- a/uwb/aidl/default/uwb_chip.cpp +++ b/uwb/aidl/default/uwb_chip.cpp @@ -17,7 +17,8 @@ #include "uwb.h" namespace { -constexpr static int kVendorUciVersion = 1; +constexpr static int32_t kAndroidUciVersion = 1; +constexpr static int64_t kAndroidCapabilities = 0; } namespace android { @@ -50,8 +51,13 @@ UwbChip::~UwbChip() {} return ndk::ScopedAStatus::ok(); } -::ndk::ScopedAStatus UwbChip::getSupportedVendorUciVersion(int32_t* version) { - *version = kVendorUciVersion; +::ndk::ScopedAStatus UwbChip::getSupportedAndroidUciVersion(int32_t* version) { + *version = kAndroidUciVersion; + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus UwbChip::getSupportedAndroidCapabilities(int64_t* capabilities) { + *capabilities = kAndroidCapabilities; return ndk::ScopedAStatus::ok(); } diff --git a/uwb/aidl/default/uwb_chip.h b/uwb/aidl/default/uwb_chip.h index ef1d5b634e..ca97120b3a 100644 --- a/uwb/aidl/default/uwb_chip.h +++ b/uwb/aidl/default/uwb_chip.h @@ -37,7 +37,8 @@ class UwbChip : public BnUwbChip { ::ndk::ScopedAStatus open(const std::shared_ptr& clientCallback) override; ::ndk::ScopedAStatus close() override; ::ndk::ScopedAStatus coreInit() override; - ::ndk::ScopedAStatus getSupportedVendorUciVersion(int32_t* version) override; + ::ndk::ScopedAStatus getSupportedAndroidUciVersion(int32_t* version) override; + ::ndk::ScopedAStatus getSupportedAndroidCapabilities(int64_t* capabilities) override; ::ndk::ScopedAStatus sendUciMessage(const std::vector& data, int32_t* bytes_written) override; diff --git a/uwb/aidl/vts/VtsHalUwbTargetTest.cpp b/uwb/aidl/vts/VtsHalUwbTargetTest.cpp index 9ac2678d3f..3820c0fc1d 100644 --- a/uwb/aidl/vts/VtsHalUwbTargetTest.cpp +++ b/uwb/aidl/vts/VtsHalUwbTargetTest.cpp @@ -166,15 +166,23 @@ TEST_P(UwbAidl, ChipCoreInit) { EXPECT_TRUE(iuwb_chip->coreInit().isOk()); } -TEST_P(UwbAidl, ChipGetSupportedVendorUciVersion) { +TEST_P(UwbAidl, ChipGetSupportedAndroidUciVersion) { const auto iuwb_chip = getAnyChipAndOpen(); EXPECT_TRUE(iuwb_chip->coreInit().isOk()); - int version; - EXPECT_TRUE(iuwb_chip->getSupportedVendorUciVersion(&version).isOk()); + int32_t version; + EXPECT_TRUE(iuwb_chip->getSupportedAndroidUciVersion(&version).isOk()); EXPECT_GT(version, 0); } +TEST_P(UwbAidl, ChipGetSupportedAndroidCapabilities) { + const auto iuwb_chip = getAnyChipAndOpen(); + EXPECT_TRUE(iuwb_chip->coreInit().isOk()); + + int64_t capabilities; + EXPECT_TRUE(iuwb_chip->getSupportedAndroidCapabilities(&capabilities).isOk()); +} + TEST_P(UwbAidl, ChipGetName) { std::string chip_name = getAnyChipName(); std::shared_ptr iuwb_chip;