Merge "Camera: Update constrained HFR VTS test."
diff --git a/audio/7.1/config/api/current.txt b/audio/7.1/config/api/current.txt
index 3a08b71..75fc5c0 100644
--- a/audio/7.1/config/api/current.txt
+++ b/audio/7.1/config/api/current.txt
@@ -359,6 +359,7 @@
enum_constant public static final android.audio.policy.configuration.V7_1.AudioUsage AUDIO_USAGE_GAME;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioUsage AUDIO_USAGE_MEDIA;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioUsage AUDIO_USAGE_NOTIFICATION;
+ enum_constant public static final android.audio.policy.configuration.V7_1.AudioUsage AUDIO_USAGE_NOTIFICATION_EVENT;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioUsage AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioUsage AUDIO_USAGE_SAFETY;
enum_constant public static final android.audio.policy.configuration.V7_1.AudioUsage AUDIO_USAGE_UNKNOWN;
diff --git a/audio/7.1/config/audio_policy_configuration.xsd b/audio/7.1/config/audio_policy_configuration.xsd
index ebc23ed..7e1da90 100644
--- a/audio/7.1/config/audio_policy_configuration.xsd
+++ b/audio/7.1/config/audio_policy_configuration.xsd
@@ -443,6 +443,7 @@
<xs:enumeration value="AUDIO_USAGE_ALARM" />
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION" />
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE" />
+ <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_EVENT" />
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index 6a0cfa5..a8846b0 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -41,7 +41,12 @@
enabled: true,
},
java: {
- platform_apis: true,
+ sdk_version: "module_current",
+ min_sdk_version: "31",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
},
ndk: {
vndk: {
diff --git a/audio/common/all-versions/default/7.0/HidlUtils.cpp b/audio/common/all-versions/default/7.0/HidlUtils.cpp
index 218d7c0..0fd2947 100644
--- a/audio/common/all-versions/default/7.0/HidlUtils.cpp
+++ b/audio/common/all-versions/default/7.0/HidlUtils.cpp
@@ -485,8 +485,12 @@
status_t HidlUtils::audioUsageFromHal(audio_usage_t halUsage, AudioUsage* usage) {
if (halUsage == AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST ||
halUsage == AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT ||
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+ halUsage == AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED) {
+#else
halUsage == AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED ||
halUsage == AUDIO_USAGE_NOTIFICATION_EVENT) {
+#endif
halUsage = AUDIO_USAGE_NOTIFICATION;
}
*usage = audio_usage_to_string(halUsage);
diff --git a/audio/common/all-versions/default/Android.bp b/audio/common/all-versions/default/Android.bp
index 8f55744..a25565d 100644
--- a/audio/common/all-versions/default/Android.bp
+++ b/audio/common/all-versions/default/Android.bp
@@ -157,6 +157,28 @@
],
}
+cc_library {
+ name: "android.hardware.audio.common@7.1-util",
+ defaults: ["android.hardware.audio.common-util_default"],
+ srcs: [
+ "7.0/HidlUtils.cpp",
+ "HidlUtilsCommon.cpp",
+ "UuidUtils.cpp",
+ ],
+ shared_libs: [
+ "android.hardware.audio.common@7.0",
+ "android.hardware.audio.common@7.1-enums",
+ "libbase",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=7",
+ "-DMINOR_VERSION=1",
+ "-DCOMMON_TYPES_MINOR_VERSION=0",
+ "-DCORE_TYPES_MINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ],
+}
+
// Note: this isn't a VTS test, but rather a unit test
// to verify correctness of conversion utilities.
cc_test {
@@ -214,3 +236,35 @@
test_suites: ["device-tests"],
}
+
+cc_test {
+ name: "android.hardware.audio.common@7.1-util_tests",
+ defaults: ["android.hardware.audio.common-util_default"],
+
+ srcs: ["tests/hidlutils_tests.cpp"],
+
+ // Use static linking to allow running in presubmit on
+ // targets that don't have HAL V7.1.
+ static_libs: [
+ "android.hardware.audio.common@7.1-enums",
+ "android.hardware.audio.common@7.1-util",
+ "android.hardware.audio.common@7.0",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libxml2",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ "-DMAJOR_VERSION=7",
+ "-DMINOR_VERSION=1",
+ "-DCOMMON_TYPES_MINOR_VERSION=0",
+ "-DCORE_TYPES_MINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ],
+
+ test_suites: ["device-tests"],
+}
diff --git a/audio/common/all-versions/default/HidlUtilsCommon.cpp b/audio/common/all-versions/default/HidlUtilsCommon.cpp
index d2da193..bc3d870 100644
--- a/audio/common/all-versions/default/HidlUtilsCommon.cpp
+++ b/audio/common/all-versions/default/HidlUtilsCommon.cpp
@@ -20,7 +20,7 @@
namespace hardware {
namespace audio {
namespace common {
-namespace CPP_VERSION {
+namespace COMMON_TYPES_CPP_VERSION {
namespace implementation {
status_t HidlUtils::audioPortConfigsFromHal(unsigned int numHalConfigs,
@@ -51,7 +51,7 @@
}
} // namespace implementation
-} // namespace CPP_VERSION
+} // namespace COMMON_TYPES_CPP_VERSION
} // namespace common
} // namespace audio
} // namespace hardware
diff --git a/audio/common/all-versions/default/TEST_MAPPING b/audio/common/all-versions/default/TEST_MAPPING
index c965113..780beea 100644
--- a/audio/common/all-versions/default/TEST_MAPPING
+++ b/audio/common/all-versions/default/TEST_MAPPING
@@ -5,6 +5,9 @@
},
{
"name": "android.hardware.audio.common@7.0-util_tests"
+ },
+ {
+ "name": "android.hardware.audio.common@7.1-util_tests"
}
]
}
diff --git a/audio/common/all-versions/default/tests/hidlutils_tests.cpp b/audio/common/all-versions/default/tests/hidlutils_tests.cpp
index 2749cce..ec16b02 100644
--- a/audio/common/all-versions/default/tests/hidlutils_tests.cpp
+++ b/audio/common/all-versions/default/tests/hidlutils_tests.cpp
@@ -23,7 +23,7 @@
#include <log/log.h>
#include <HidlUtils.h>
-#include <android_audio_policy_configuration_V7_0-enums.h>
+#include PATH(APM_XSD_ENUMS_H_FILENAME)
#include <system/audio.h>
#include <xsdc/XsdcSupport.h>
@@ -32,7 +32,7 @@
using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils;
namespace xsd {
-using namespace ::android::audio::policy::configuration::V7_0;
+using namespace ::android::audio::policy::configuration::CPP_VERSION;
}
static constexpr audio_channel_mask_t kInvalidHalChannelMask = AUDIO_CHANNEL_INVALID;
diff --git a/audio/core/all-versions/default/Android.bp b/audio/core/all-versions/default/Android.bp
index df688fd..3536561 100644
--- a/audio/core/all-versions/default/Android.bp
+++ b/audio/core/all-versions/default/Android.bp
@@ -168,10 +168,10 @@
shared_libs: [
"android.hardware.audio@7.0",
"android.hardware.audio@7.1",
- "android.hardware.audio@7.0-util",
+ "android.hardware.audio@7.1-util",
"android.hardware.audio.common@7.0",
"android.hardware.audio.common@7.1-enums",
- "android.hardware.audio.common@7.0-util",
+ "android.hardware.audio.common@7.1-util",
"libbase",
],
cflags: [
diff --git a/audio/core/all-versions/default/TEST_MAPPING b/audio/core/all-versions/default/TEST_MAPPING
index 1e29440..07e98f3 100644
--- a/audio/core/all-versions/default/TEST_MAPPING
+++ b/audio/core/all-versions/default/TEST_MAPPING
@@ -4,6 +4,9 @@
"name": "android.hardware.audio@7.0-util_tests"
},
{
+ "name": "android.hardware.audio@7.1-util_tests"
+ },
+ {
"name": "HalAudioV6_0GeneratorTest"
},
{
diff --git a/audio/core/all-versions/default/util/Android.bp b/audio/core/all-versions/default/util/Android.bp
index 7caf18d..b96f2d2 100644
--- a/audio/core/all-versions/default/util/Android.bp
+++ b/audio/core/all-versions/default/util/Android.bp
@@ -112,6 +112,25 @@
],
}
+cc_library {
+ name: "android.hardware.audio@7.1-util",
+ defaults: ["android.hardware.audio-util_default"],
+ shared_libs: [
+ "android.hardware.audio.common@7.0",
+ "android.hardware.audio.common@7.1-enums",
+ "android.hardware.audio.common@7.1-util",
+ "android.hardware.audio@7.1",
+ "libbase",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=7",
+ "-DMINOR_VERSION=1",
+ "-DCOMMON_TYPES_MINOR_VERSION=0",
+ "-DCORE_TYPES_MINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ],
+}
+
// Note: this isn't a VTS test, but rather a unit test
// to verify correctness of conversion utilities.
cc_test {
@@ -145,3 +164,37 @@
test_suites: ["device-tests"],
}
+
+cc_test {
+ name: "android.hardware.audio@7.1-util_tests",
+ defaults: ["android.hardware.audio-util_default"],
+
+ srcs: ["tests/coreutils_tests.cpp"],
+
+ // Use static linking to allow running in presubmit on
+ // targets that don't have HAL V7.1.
+ static_libs: [
+ "android.hardware.audio.common@7.0",
+ "android.hardware.audio.common@7.1-enums",
+ "android.hardware.audio.common@7.1-util",
+ "android.hardware.audio@7.1",
+ "android.hardware.audio@7.1-util",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libxml2",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ "-DMAJOR_VERSION=7",
+ "-DMINOR_VERSION=1",
+ "-DCOMMON_TYPES_MINOR_VERSION=0",
+ "-DCORE_TYPES_MINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ],
+
+ test_suites: ["device-tests"],
+}
diff --git a/audio/core/all-versions/default/util/tests/coreutils_tests.cpp b/audio/core/all-versions/default/util/tests/coreutils_tests.cpp
index 3976b08..0e15960 100644
--- a/audio/core/all-versions/default/util/tests/coreutils_tests.cpp
+++ b/audio/core/all-versions/default/util/tests/coreutils_tests.cpp
@@ -22,18 +22,18 @@
#define LOG_TAG "CoreUtils_Test"
#include <log/log.h>
-#include <android_audio_policy_configuration_V7_0-enums.h>
+#include PATH(APM_XSD_ENUMS_H_FILENAME)
#include <system/audio.h>
#include <util/CoreUtils.h>
#include <xsdc/XsdcSupport.h>
using namespace android;
using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
-using namespace ::android::hardware::audio::CPP_VERSION;
+using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION;
using ::android::hardware::hidl_vec;
-using ::android::hardware::audio::CPP_VERSION::implementation::CoreUtils;
+using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::CoreUtils;
namespace xsd {
-using namespace ::android::audio::policy::configuration::V7_0;
+using namespace ::android::audio::policy::configuration::CPP_VERSION;
}
static constexpr audio_channel_mask_t kInvalidHalChannelMask = AUDIO_CHANNEL_INVALID;
diff --git a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
index a9797bb..7f4a777 100644
--- a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
@@ -28,8 +28,7 @@
if (getDeviceName() != DeviceManager::kPrimaryDevice) {
GTEST_SKIP() << "No primary device on this factory"; // returns
}
- EXPECT_TRUE(
- DeviceManager::getInstance().reset(getFactoryName(), DeviceManager::kPrimaryDevice));
+ EXPECT_TRUE(DeviceManager::getInstance().resetPrimary(getFactoryName()));
// Must use IDevicesFactory directly because DeviceManager always uses
// the latest interfaces version and corresponding methods for opening
diff --git a/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
index 6b9b32d..09b25d9 100644
--- a/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
@@ -47,6 +47,7 @@
// initial state. To workaround this, destroy the HAL at the end of this test.
ASSERT_TRUE(resetDevice());
}
+
class LatencyModeOutputStreamTest : public OutputStreamTest {
protected:
void SetUp() override {
@@ -95,3 +96,8 @@
EXPECT_OK(stream->setLatencyModeCallback(new MockOutLatencyModeCallback));
EXPECT_OK(stream->setLatencyModeCallback(nullptr));
}
+
+INSTANTIATE_TEST_CASE_P(LatencyModeOutputStream, LatencyModeOutputStreamTest,
+ ::testing::ValuesIn(getOutputDeviceSingleConfigParameters()),
+ &DeviceConfigParameterToString);
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(LatencyModeOutputStreamTest);
diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp
index 61ab1bb..87063a7 100644
--- a/audio/core/all-versions/vts/functional/Android.bp
+++ b/audio/core/all-versions/vts/functional/Android.bp
@@ -200,7 +200,7 @@
"android.hardware.audio.common@7.0",
"android.hardware.audio.common@7.0-enums",
"android.hardware.audio.common@7.1-enums",
- "android.hardware.audio.common@7.0-util",
+ "android.hardware.audio.common@7.1-util",
],
cflags: [
"-DMAJOR_VERSION=7",
diff --git a/audio/core/all-versions/vts/functional/DeviceManager.h b/audio/core/all-versions/vts/functional/DeviceManager.h
index c8e0167..6bb39ed 100644
--- a/audio/core/all-versions/vts/functional/DeviceManager.h
+++ b/audio/core/all-versions/vts/functional/DeviceManager.h
@@ -96,40 +96,83 @@
}
};
-using FactoryAndDevice = std::tuple<std::string, std::string>;
-class DeviceManager : public InterfaceManager<DeviceManager, FactoryAndDevice, IDevice> {
+namespace impl {
+
+class PrimaryDeviceManager
+ : public InterfaceManager<PrimaryDeviceManager, std::string, IPrimaryDevice> {
public:
- static DeviceManager& getInstance() {
- static DeviceManager instance;
- return instance;
+ static sp<IPrimaryDevice> createInterfaceInstance(const std::string& factoryName) {
+ sp<IDevicesFactory> factory = DevicesFactoryManager::getInstance().get(factoryName);
+ return openPrimaryDevice(factory);
}
+
+ bool reset(const std::string& factoryName) __attribute__((warn_unused_result)) {
+#if MAJOR_VERSION <= 5
+ return InterfaceManager::reset(factoryName, true);
+#elif MAJOR_VERSION >= 6
+ {
+ sp<IPrimaryDevice> device = getExisting(factoryName);
+ if (device != nullptr) {
+ auto ret = device->close();
+ ALOGE_IF(!ret.isOk(), "PrimaryDevice %s close failed: %s", factoryName.c_str(),
+ ret.description().c_str());
+ }
+ }
+ return InterfaceManager::reset(factoryName, false);
+#endif
+ }
+
+ private:
+ static sp<IPrimaryDevice> openPrimaryDevice(const sp<IDevicesFactory>& factory) {
+ if (factory == nullptr) return {};
+ Result result;
+ sp<IPrimaryDevice> primaryDevice;
+#if !(MAJOR_VERSION == 7 && MINOR_VERSION == 1)
+ sp<IDevice> device;
+#if MAJOR_VERSION == 2
+ auto ret = factory->openDevice(IDevicesFactory::Device::PRIMARY, returnIn(result, device));
+ if (ret.isOk() && result == Result::OK && device != nullptr) {
+ primaryDevice = IPrimaryDevice::castFrom(device);
+ }
+#elif MAJOR_VERSION >= 4
+ auto ret = factory->openPrimaryDevice(returnIn(result, device));
+ if (ret.isOk() && result == Result::OK && device != nullptr) {
+ primaryDevice = IPrimaryDevice::castFrom(device);
+ }
+#endif
+ if (!ret.isOk() || result != Result::OK || primaryDevice == nullptr) {
+ ALOGW("Primary device can not be opened, transaction: %s, result %d, device %p",
+ ret.description().c_str(), result, device.get());
+ return nullptr;
+ }
+#else // V7.1
+ auto ret = factory->openPrimaryDevice_7_1(returnIn(result, primaryDevice));
+ if (!ret.isOk() || result != Result::OK) {
+ ALOGW("Primary device can not be opened, transaction: %s, result %d",
+ ret.description().c_str(), result);
+ return nullptr;
+ }
+#endif
+ return primaryDevice;
+ }
+};
+
+using FactoryAndDevice = std::tuple<std::string, std::string>;
+class RegularDeviceManager
+ : public InterfaceManager<RegularDeviceManager, FactoryAndDevice, IDevice> {
+ public:
static sp<IDevice> createInterfaceInstance(const FactoryAndDevice& factoryAndDevice) {
auto [factoryName, name] = factoryAndDevice;
sp<IDevicesFactory> factory = DevicesFactoryManager::getInstance().get(factoryName);
return openDevice(factory, name);
}
- using InterfaceManager::reset;
-
- static constexpr const char* kPrimaryDevice = "primary";
sp<IDevice> get(const std::string& factoryName, const std::string& name) {
- if (name == kPrimaryDevice) {
- (void)getPrimary(factoryName); // for initializing primaryDevice if needed.
- }
return InterfaceManager::get(std::make_tuple(factoryName, name));
}
- sp<IPrimaryDevice> getPrimary(const std::string& factoryName) {
- if (primaryDevice == nullptr) {
- sp<IDevicesFactory> factory = DevicesFactoryManager::getInstance().get(factoryName);
- primaryDevice = openPrimaryDevice(factory);
- }
- return primaryDevice;
- }
+
bool reset(const std::string& factoryName, const std::string& name)
__attribute__((warn_unused_result)) {
- if (name == kPrimaryDevice) {
- primaryDevice.clear();
- }
#if MAJOR_VERSION <= 5
return InterfaceManager::reset(std::make_tuple(factoryName, name), true);
#elif MAJOR_VERSION >= 6
@@ -144,9 +187,6 @@
return InterfaceManager::reset(std::make_tuple(factoryName, name), false);
#endif
}
- bool resetPrimary(const std::string& factoryName) __attribute__((warn_unused_result)) {
- return reset(factoryName, kPrimaryDevice);
- }
private:
static sp<IDevice> openDevice(const sp<IDevicesFactory>& factory, const std::string& name) {
@@ -155,9 +195,7 @@
sp<IDevice> device;
#if MAJOR_VERSION == 2
IDevicesFactory::Device dev = IDevicesFactory::IDevicesFactory::Device(-1);
- if (name == AUDIO_HARDWARE_MODULE_ID_PRIMARY) {
- dev = IDevicesFactory::Device::PRIMARY;
- } else if (name == AUDIO_HARDWARE_MODULE_ID_A2DP) {
+ if (name == AUDIO_HARDWARE_MODULE_ID_A2DP) {
dev = IDevicesFactory::Device::A2DP;
} else if (name == AUDIO_HARDWARE_MODULE_ID_USB) {
dev = IDevicesFactory::Device::USB;
@@ -179,47 +217,62 @@
}
return device;
}
+};
- static sp<IPrimaryDevice> openPrimaryDevice(const sp<IDevicesFactory>& factory) {
- if (factory == nullptr) return {};
- Result result;
- sp<IDevice> device;
- sp<IPrimaryDevice> primaryDevice;
-#if MAJOR_VERSION == 2
- auto ret = factory->openDevice(IDevicesFactory::Device::PRIMARY, returnIn(result, device));
- if (ret.isOk() && result == Result::OK && device != nullptr) {
- primaryDevice = IPrimaryDevice::castFrom(device);
+} // namespace impl
+
+class DeviceManager {
+ public:
+ static DeviceManager& getInstance() {
+ static DeviceManager instance;
+ return instance;
+ }
+
+ static constexpr const char* kPrimaryDevice = "primary";
+
+ sp<IDevice> get(const std::string& factoryName, const std::string& name) {
+ if (name == kPrimaryDevice) {
+ auto primary = getPrimary(factoryName);
+ return primary ? deviceFromPrimary(primary) : nullptr;
}
-#elif MAJOR_VERSION >= 4 && (MAJOR_VERSION < 7 || (MAJOR_VERSION == 7 && MINOR_VERSION == 0))
- auto ret = factory->openPrimaryDevice(returnIn(result, device));
- if (ret.isOk() && result == Result::OK && device != nullptr) {
- primaryDevice = IPrimaryDevice::castFrom(device);
- }
-#elif MAJOR_VERSION == 7 && MINOR_VERSION == 1
- auto ret = factory->openPrimaryDevice_7_1(returnIn(result, primaryDevice));
- if (ret.isOk() && result == Result::OK && primaryDevice != nullptr) {
- auto getDeviceRet = primaryDevice->getDevice();
- if (getDeviceRet.isOk()) {
- device = getDeviceRet;
- } else {
- primaryDevice.clear();
- ALOGW("Primary device can not downcast, transaction: %s, primary %p",
- getDeviceRet.description().c_str(), primaryDevice.get());
- return {};
- }
- }
-#endif
- if (!ret.isOk() || result != Result::OK || device == nullptr) {
- ALOGW("Primary device can not be opened, transaction: %s, result %d, device %p",
- ret.description().c_str(), result, device.get());
- return {};
- }
- return primaryDevice;
+ return mDevices.get(factoryName, name);
+ }
+
+ sp<IPrimaryDevice> getPrimary(const std::string& factoryName) {
+ return mPrimary.get(factoryName);
+ }
+
+ bool reset(const std::string& factoryName, const std::string& name)
+ __attribute__((warn_unused_result)) {
+ return name == kPrimaryDevice ? resetPrimary(factoryName)
+ : mDevices.reset(factoryName, name);
+ }
+
+ bool resetPrimary(const std::string& factoryName) __attribute__((warn_unused_result)) {
+ return mPrimary.reset(factoryName);
+ }
+
+ static void waitForInstanceDestruction() {
+ // Does not matter which device manager to use.
+ impl::RegularDeviceManager::waitForInstanceDestruction();
}
private:
- // There can only be one primary device across all HAL modules.
- // A reference to a complete interface is used because in V7.1 IDevice can not
- // be upcasted to IPrimaryDevice.
- sp<IPrimaryDevice> primaryDevice;
+ sp<IDevice> deviceFromPrimary(const sp<IPrimaryDevice>& primary) {
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+ auto ret = primary->getDevice();
+ if (ret.isOk()) {
+ return ret;
+ } else {
+ ALOGW("Error retrieving IDevice from primary: transaction: %s, primary %p",
+ ret.description().c_str(), primary.get());
+ return nullptr;
+ }
+#else
+ return primary;
+#endif
+ }
+
+ impl::PrimaryDeviceManager mPrimary;
+ impl::RegularDeviceManager mDevices;
};
diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp
index 5e69429..890d7a0 100644
--- a/automotive/audiocontrol/aidl/Android.bp
+++ b/automotive/audiocontrol/aidl/Android.bp
@@ -13,6 +13,10 @@
name: "android.hardware.automotive.audiocontrol",
vendor_available: true,
srcs: ["android/hardware/automotive/audiocontrol/*.aidl"],
+ imports: [
+ "android.hardware.audio.common",
+ "android.media.audio.common.types",
+ ],
stability: "vintf",
backend: {
java: {
@@ -24,5 +28,7 @@
],
},
},
- versions: ["1"],
+ versions: [
+ "1",
+ ],
}
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
index 3dc393a..58a3667 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
@@ -1,14 +1,30 @@
+/*
+ * 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
similarity index 88%
copy from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
copy to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
index d2b48d2..91ce035 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
@@ -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.
@@ -31,9 +31,10 @@
// with such a backward incompatible 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;
+package android.hardware.automotive.audiocontrol;
@VintfStability
-parcelable DecryptResult {
- int bytesWritten;
- String detailedError;
+parcelable AudioGainConfigInfo {
+ int zoneId;
+ String devicePortAddress;
+ int volumeIndex;
}
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
index 6d729e2..23abb46 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
@@ -1,14 +1,30 @@
+/*
+ * 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
@@ -22,4 +38,5 @@
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/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 bc4162b..8dc5ffe 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
@@ -1,14 +1,30 @@
+/*
+ * 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
@@ -18,10 +34,16 @@
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);
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
similarity index 83%
rename from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl
rename to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
index 0d4296e..17a087f 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
@@ -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.
@@ -31,9 +31,8 @@
// with such a backward incompatible 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;
+package android.hardware.automotive.audiocontrol;
@VintfStability
-interface ICryptoFactory {
- @nullable android.hardware.drm.ICryptoPlugin createPlugin(in android.hardware.drm.Uuid uuid, in byte[] initData);
- boolean isCryptoSchemeSupported(in android.hardware.drm.Uuid uuid);
+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/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl
index f00f042..3e17552 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl
@@ -1,14 +1,30 @@
+/*
+ * 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
@@ -20,4 +36,6 @@
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/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
index ab902ec..b25ed0f 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
@@ -1,14 +1,30 @@
+/*
+ * 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 interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/Reasons.aidl
similarity index 81%
rename from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl
rename to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/Reasons.aidl
index b6ec34d..c1e22d4 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/Reasons.aidl
@@ -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.
@@ -31,9 +31,17 @@
// with such a backward incompatible 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;
+package android.hardware.automotive.audiocontrol;
@Backing(type="int") @VintfStability
-enum BufferType {
- SHARED_MEMORY = 0,
- NATIVE_HANDLE = 1,
+enum Reasons {
+ FORCED_MASTER_MUTE = 1,
+ REMOTE_MUTE = 2,
+ TCU_MUTE = 4,
+ ADAS_DUCKING = 8,
+ NAV_DUCKING = 16,
+ PROJECTION_DUCKING = 32,
+ THERMAL_LIMITATION = 64,
+ SUSPEND_EXIT_VOL_LIMITATION = 128,
+ EXTERNAL_AMP_VOL_FEEDBACK = 256,
+ OTHER = -2147483648,
}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl
new file mode 100644
index 0000000..68bfeab
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.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.
+ */
+
+package android.hardware.automotive.audiocontrol;
+
+/**
+ * NOTE:
+ * Was expecting to reuse android.media.audio types... Limit info to minimum to prevent
+ * duplicating aidl_api. Will follow up if AudioGainConfig is exposed by android.media AIDL API.
+ */
+@VintfStability
+parcelable AudioGainConfigInfo {
+ /**
+ * The identifier for the audio zone the audio device port associated to this gain belongs to.
+ *
+ */
+ int zoneId;
+
+ /**
+ * The Audio Output Device Port Address.
+ *
+ * This is the address that can be retrieved at JAVA layer using the introspection
+ * {@link android.media.AudioManager#listAudioDevicePorts} API then
+ * {@link audio.media.AudioDeviceInfo#getAddress} API.
+ *
+ * At HAL layer, it corresponds to audio_port_v7.audio_port_device_ext.address.
+ *
+ * Devices that does not have an address will indicate an empty string "".
+ */
+ String devicePortAddress;
+
+ /**
+ * UI Index of the corresponding AudioGain in AudioPort.gains.
+ */
+ int volumeIndex;
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
index e95fe9b..513af47 100644
--- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
@@ -14,41 +14,51 @@
* limitations under the License.
*/
- package android.hardware.automotive.audiocontrol;
+package android.hardware.automotive.audiocontrol;
- /**
- * The current ducking information for a single audio zone.
- *
- * <p>This includes devices to duck, as well as unduck based on the contents of a previous
- * {@link DuckingInfo}. Additionally, the current usages holding focus in the specified zone are
- * included, which were used to determine which addresses to duck.
- */
- @VintfStability
- parcelable DuckingInfo {
- /**
- * ID of the associated audio zone
- */
- int zoneId;
+import android.hardware.audio.common.PlaybackTrackMetadata;
- /**
- * List of addresses for audio output devices that should be ducked.
- *
- * <p>The provided address strings are defined in audio_policy_configuration.xml.
- */
- String[] deviceAddressesToDuck;
+/**
+ * The current ducking information for a single audio zone.
+ *
+ * <p>This includes devices to duck, as well as unduck based on the contents of a previous
+ * {@link DuckingInfo}. Additionally, the current usages holding focus in the specified zone are
+ * included, which were used to determine which addresses to duck.
+ */
+@VintfStability
+parcelable DuckingInfo {
+ /**
+ * ID of the associated audio zone
+ */
+ int zoneId;
- /**
- * List of addresses for audio output devices that were previously be ducked and should now be
- * unducked.
- *
- * <p>The provided address strings are defined in audio_policy_configuration.xml.
- */
- String[] deviceAddressesToUnduck;
+ /**
+ * List of addresses for audio output devices that should be ducked.
+ *
+ * <p>The provided address strings are defined in audio_policy_configuration.xml.
+ */
+ String[] deviceAddressesToDuck;
- /**
- * List of usages currently holding focus for this audio zone.
- *
- * <p> See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
- */
- String[] usagesHoldingFocus;
- }
\ No newline at end of file
+ /**
+ * List of addresses for audio output devices that were previously be ducked and should now be
+ * unducked.
+ *
+ * <p>The provided address strings are defined in audio_policy_configuration.xml.
+ */
+ String[] deviceAddressesToUnduck;
+
+ /**
+ * List of usages currently holding focus for this audio zone.
+ *
+ * This field was deprecated in version 2.
+ * Use playbackMetaDataHoldingFocus instead.
+ *
+ * <p> See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
+ */
+ String[] usagesHoldingFocus;
+
+ /**
+ * List of output stream metadata associated with the current focus holder for this audio zone
+ */
+ @nullable PlaybackTrackMetadata[] playbackMetaDataHoldingFocus;
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
index 3a02245..0ffcd5e 100644
--- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -16,10 +16,43 @@
package android.hardware.automotive.audiocontrol;
+/**
+ * Important note on Metadata:
+ * Metadata qualifies a playback track for an output stream.
+ * This is highly closed to {@link android.media.AudioAttributes}.
+ * It allows to identify the audio stream rendered / requesting / abandonning the focus.
+ *
+ * AudioControl 1.0 was limited to identification through {@code AttributeUsage} listed as
+ * {@code audioUsage} in audio_policy_configuration.xsd.
+ *
+ * Any new OEM needs would not be possible without extension.
+ *
+ * Relying on {@link android.hardware.automotive.audiocontrol.PlaybackTrackMetadata} allows
+ * to use a combination of {@code AttributeUsage}, {@code AttributeContentType} and
+ * {@code AttributeTags} to identify the use case / routing thanks to
+ * {@link android.media.audiopolicy.AudioProductStrategy}.
+ * The belonging to a strategy is deduced by an AOSP logic (in sync at native and java layer).
+ *
+ * IMPORTANT NOTE ON TAGS:
+ * To limit the possibilies and prevent from confusion, we expect the String to follow
+ * a given formalism that will be enforced.
+ *
+ * 1 / By convention, tags shall be a "key=value" pair.
+ * Vendor must namespace their tag's key (for example com.google.strategy=VR) to avoid conflicts.
+ * vendor specific applications and must be prefixed by "VX_". Vendor must
+ *
+ * 2 / Tags reported here shall be the same as the tags used to define a given
+ * {@link android.media.audiopolicy.AudioProductStrategy} and so in
+ * audio_policy_engine_configuration.xml file.
+ */
+import android.hardware.audio.common.PlaybackTrackMetadata;
import android.hardware.automotive.audiocontrol.AudioFocusChange;
+import android.hardware.automotive.audiocontrol.AudioGainConfigInfo;
import android.hardware.automotive.audiocontrol.DuckingInfo;
-import android.hardware.automotive.audiocontrol.MutingInfo;
+import android.hardware.automotive.audiocontrol.IAudioGainCallback;
import android.hardware.automotive.audiocontrol.IFocusListener;
+import android.hardware.automotive.audiocontrol.MutingInfo;
+import android.hardware.automotive.audiocontrol.Reasons;
/**
* Interacts with the car's audio subsystem to manage audio sources and volumes
@@ -36,8 +69,12 @@
* The HAL is not required to wait for an callback of AUDIOFOCUS_GAIN before playing audio, nor
* is it required to stop playing audio in the event of a AUDIOFOCUS_LOSS callback is received.
*
+ * This method was deprecated in version 2 to allow getting rid of usages limitation.
+ * Use {@link IAudioControl#onAudioFocusChangeWithMetaData} instead.
+ *
* @param usage The audio usage associated with the focus change {@code AttributeUsage}. See
* {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
+ * @deprecated use {@link android.hardware.audio.common.PlaybackTrackMetadata} instead.
* @param zoneId The identifier for the audio zone that the HAL is playing the stream in
* @param focusChange the AudioFocusChange that has occurred.
*/
@@ -52,19 +89,19 @@
* @param duckingInfos an array of {@link DuckingInfo} objects for the audio zones where audio
* focus has changed.
*/
- oneway void onDevicesToDuckChange(in DuckingInfo[] duckingInfos);
+ oneway void onDevicesToDuckChange(in DuckingInfo[] duckingInfos);
- /**
- * Notifies HAL of changes in output devices that the HAL should apply muting to.
- *
- * This will be called in response to changes in audio mute state for each volume group
- * and will include a {@link MutingInfo} object per audio zone that experienced a mute state
- * event.
- *
- * @param mutingInfos an array of {@link MutingInfo} objects for the audio zones where audio
- * mute state has changed.
- */
- oneway void onDevicesToMuteChange(in MutingInfo[] mutingInfos);
+ /**
+ * Notifies HAL of changes in output devices that the HAL should apply muting to.
+ *
+ * This will be called in response to changes in audio mute state for each volume group
+ * and will include a {@link MutingInfo} object per audio zone that experienced a mute state
+ * event.
+ *
+ * @param mutingInfos an array of {@link MutingInfo} objects for the audio zones where audio
+ * mute state has changed.
+ */
+ oneway void onDevicesToMuteChange(in MutingInfo[] mutingInfos);
/**
* Registers focus listener to be used by HAL for requesting and abandoning audio focus.
@@ -99,4 +136,51 @@
* range.
*/
oneway void setFadeTowardFront(in float value);
-}
\ No newline at end of file
+
+ /**
+ * Notifies HAL of changes in audio focus status for focuses requested or abandoned by the HAL.
+ *
+ * This will be called in response to IFocusListener's requestAudioFocus and
+ * abandonAudioFocus, as well as part of any change in focus being held by the HAL due focus
+ * request from other activities or services.
+ *
+ * The HAL is not required to wait for an callback of AUDIOFOCUS_GAIN before playing audio, nor
+ * is it required to stop playing audio in the event of a AUDIOFOCUS_LOSS callback is received.
+ *
+ * @param playbackMetaData The output stream metadata associated with the focus request
+ * @param zoneId The identifier for the audio zone that the HAL is playing the stream in
+ * @param focusChange the AudioFocusChange that has occurred.
+ */
+ oneway void onAudioFocusChangeWithMetaData(in PlaybackTrackMetadata playbackMetaData,
+ in int zoneId, in AudioFocusChange focusChange);
+
+ /**
+ * Notifies HAL of changes in output devices that the HAL should apply gain change to
+ * and the reason(s) why
+ *
+ * This may be called in response to changes in audio focus, and will include a list of
+ * {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} objects per audio zone
+ * that experienced a change in audo focus.
+ *
+ * @param reasons List of reasons that triggered the given gains changed.
+ * This must be one or more of the
+ * {@link android.hardware.automotive.audiocontrol.Reasons} constants.
+ *
+ * @param gains List of gains the change is intended to.
+ */
+ oneway void setAudioDeviceGainsChanged(in Reasons[] reasons, in AudioGainConfigInfo[] gains);
+
+ /**
+ * Registers callback to be used by HAL for reporting unexpected gain(s) changed and the
+ * reason(s) why.
+ *
+ * It is expected that there will only ever be a single callback registered. If the
+ * observer dies, the HAL implementation must unregister observer automatically. If called when
+ * a listener is already registered, the existing one should be unregistered and replaced with
+ * the new callback.
+ *
+ * @param callback The {@link android.hardware.automotive.audiocontrol.IAudioGainCallback}
+ * interface.
+ */
+ oneway void registerGainCallback(in IAudioGainCallback callback);
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl
new file mode 100644
index 0000000..17b4341
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioGainCallback.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.automotive.audiocontrol;
+
+import android.hardware.automotive.audiocontrol.AudioGainConfigInfo;
+import android.hardware.automotive.audiocontrol.Reasons;
+
+/**
+ * Interface definition for a callback to be invoked when the gain(s) of the device port(s) is(are)
+ * updated at HAL layer.
+ *
+ * <p>This defines counter part API of
+ * {@link android.hardware.automotive.audiocontrol.IAudioControl#onDevicesToDuckChange},
+ * {@link android.hardware.automotive.audiocontrol.IAudioControl#onDevicesToMuteChange} and
+ * {@link android.hardware.automotive.audiocontrol.IAudioControl#setAudioDeviceGainsChanged} APIs.
+ *
+ * The previous API defines Mute/Duck order decided by the client (e.g. CarAudioService)
+ * and delegated to AudioControl for application.
+ *
+ * This callback interface defines Mute/Duck notification decided by AudioControl HAL (due to
+ * e.g. - external conditions from Android IVI subsystem
+ * - regulation / need faster decision rather than using
+ * {@link android.hardware.automotive.audiocontrol.IAudioControl#onAudioFocusChange} to
+ * report the use case and then waiting for CarAudioService decision to Mute/Duck.
+ */
+@VintfStability
+oneway interface IAudioGainCallback {
+ /**
+ * Used to indicated the one or more audio device port gains have changed unexpectidely, i.e.
+ * initiated by HAL, not by CarAudioService.
+ * This is the counter part of the
+ * {@link android.hardware.automotive.audiocontrol.onDevicesToDuckChange},
+ * {@link android.hardware.automotive.audiocontrol.onDevicesToMuteChange} and
+ * {@link android.hardware.automotive.audiocontrol.setAudioDeviceGainsChanged} APIs.
+ *
+ * Flexibility is given to OEM to mute/duck in HAL or in CarAudioService.
+ * For critical use cases (i.e. when regulation is required), better to handle mute/duck in
+ * HAL layer and informs upper layer.
+ * Non critical use case may report gain and focus and CarAudioService to decide of duck/mute.
+ *
+ * @param reasons List of reasons that triggered the given gains changed.
+ * This must be one or more of the
+ * {@link android.hardware.automotive.audiocontrol.Reasons} constants.
+ * It will define if the port has been muted/ducked or must now affected
+ * by gain limitation that shall be notified/enforced at CarAudioService
+ * layer.
+ *
+ * @param gains List of gains affected by the change.
+ */
+ void onAudioDeviceGainsChanged(in Reasons[] reasons, in AudioGainConfigInfo[] gains);
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl
index b79295a..ac9ac01 100644
--- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl
@@ -16,12 +16,14 @@
package android.hardware.automotive.audiocontrol;
+import android.hardware.audio.common.PlaybackTrackMetadata;
import android.hardware.automotive.audiocontrol.AudioFocusChange;
/**
* Callback interface for audio focus listener.
*
* For typical configuration, the listener the car audio service.
+ *
*/
@VintfStability
interface IFocusListener {
@@ -33,6 +35,9 @@
* interaction is oneway to avoid blocking HAL so that it is not required to wait for a response
* before stopping audio playback.
*
+ * Deprecated in version 2 to allow generic interface callback listener.
+ * Use {@link IFocusListener#abandonHalAudioFocusWithMetaData} instead.
+ *
* @param usage The audio usage for which the HAL is abandoning focus {@code AttributeUsage}.
* See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
* @param zoneId The identifier for the audio zone that the HAL abandoning focus
@@ -47,6 +52,9 @@
* interaction is oneway to avoid blocking HAL so that it is not required to wait for a response
* before playing audio.
*
+ * Deprecated in version 2 to allow generic interface callback listener.
+ * Use {@link IFocusListener#requestAudioFocusWithMetaData} instead.
+ *
* @param usage The audio usage associated with the focus request {@code AttributeUsage}. See
* {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
* @param zoneId The identifier for the audio zone where the HAL is requesting focus
@@ -54,4 +62,29 @@
* following: GAIN, GAIN_TRANSIENT, GAIN_TRANSIENT_MAY_DUCK, GAIN_TRANSIENT_EXCLUSIVE.
*/
oneway void requestAudioFocus(in String usage, in int zoneId, in AudioFocusChange focusGain);
-}
\ No newline at end of file
+
+ /**
+ * Used to indicate that the audio output stream associated with
+ * {@link android.hardware.audio.common.PlaybackTrackMetadata} has released
+ * the focus.
+ *
+ * @param playbackMetaData The output stream metadata associated with the focus request
+ * @param zoneId The identifier for the audio zone that the HAL abandoning focus
+ */
+ oneway void abandonAudioFocusWithMetaData(
+ in PlaybackTrackMetadata playbackMetaData, in int zoneId);
+
+ /**
+ * Used to indicate that the audio output stream associated with
+ * {@link android.hardware.audio.common.PlaybackTrackMetadata} has taken the focus.
+ *
+ * @param playbackMetaData The output stream metadata associated with the focus request
+ * @param zoneId The identifier for the audio zone that the HAL abandoning focus
+ * @param focusGain The focus type requested.
+ * This must be one of the
+ * {@link android.hardware.automotive.audiocontrol.AudioFocusChange}
+ * constants.
+ */
+ oneway void requestAudioFocusWithMetaData(in PlaybackTrackMetadata playbackMetaData,
+ in int zoneId, in AudioFocusChange focusGain);
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl
new file mode 100644
index 0000000..860bf01
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.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.automotive.audiocontrol;
+
+/**
+ * Enum to identify the reason(s) of
+ * {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} changed event
+ */
+@Backing(type="int")
+@VintfStability
+enum Reasons {
+ /**
+ * Magic Key Code (may be SWRC button combination) to force muting all audio sources.
+ * This may be used for example in case of cyber attach to ensure driver can safely drive back
+ * to garage to restore sw.
+ */
+ FORCED_MASTER_MUTE = 0x1,
+ /**
+ * Reports a mute request outside the IVI (Android) system.
+ * It may target to mute the list of
+ * {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo}.
+ * A focus request may also be reported in addition if the use case that initiates the mute
+ * has matching {@link android.hardware.automotive.audiocontrol.PlaybackTrackMetadata}
+ * For regulation issue, the action of mute could be managed by HAL itself.
+ */
+ REMOTE_MUTE = 0x2,
+ /**
+ * Reports a mute initiated by the TCU. It may be applied to all audio source (no
+ * associated {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} reported, or
+ * it may target to mute only the given list of ports.
+ * A focus request may also be reported in addition.
+ * For regulation issue, the action of mute could be managed by HAL itself.
+ */
+ TCU_MUTE = 0x4,
+ /**
+ * Reports a duck due to ADAS use case. A focus request may also be reported in addition.
+ * For regulation issue, the action of duck could be managed by HAL itself.
+ * It gives a chance to CarAudioService to decide whether contextual volume change may be
+ * applied from the ducked index base or not.
+ */
+ ADAS_DUCKING = 0x8,
+ /**
+ * Reports a duck due to navigation use case. It gives a chance to CarAudioService to decide
+ * whether contextual volume change may be applied from the ducked index base or not.
+ */
+ NAV_DUCKING = 0x10,
+ /**
+ * Some device projection stack may send signal to IVI to duck / unduck main audio stream.
+ * In this case, Contextual Volume Policy may be adapted to control the alternate / secondary
+ * audio stream.
+ */
+ PROJECTION_DUCKING = 0x20,
+ /**
+ * When the amplifier is overheating, it may be recovered by limiting the volume.
+ */
+ THERMAL_LIMITATION = 0x40,
+ /**
+ * Before the system enters suspend, it may ensure while exiting suspend or during cold boot
+ * that the volume is limited to prevent from sound explosion.
+ */
+ SUSPEND_EXIT_VOL_LIMITATION = 0x80,
+ /**
+ * When using an external amplifier, it may be required to keep volume in sync and have
+ * asynchronous notification of effective volume change.
+ */
+ EXTERNAL_AMP_VOL_FEEDBACK = 0x100,
+ /**
+ * For other OEM use.
+ */
+ OTHER = 0x80000000,
+}
diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Stream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Stream.aidl
index a780412..154a693 100644
--- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Stream.aidl
+++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Stream.aidl
@@ -38,6 +38,7 @@
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/android/hardware/automotive/evs/Stream.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/Stream.aidl
index ae5c7f0..663ba22 100644
--- a/automotive/evs/aidl/android/hardware/automotive/evs/Stream.aidl
+++ b/automotive/evs/aidl/android/hardware/automotive/evs/Stream.aidl
@@ -55,7 +55,7 @@
int height;
/**
* The frame rate of this stream in frames-per-second
- /
+ */
int framerate;
/**
* The pixel format form the buffers in this stream.
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 5cd814c..04f8fa3 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
@@ -205,4 +205,5 @@
EV_CHARGE_TIME_REMAINING = 289410883,
EV_REGENERATIVE_BRAKING_STATE = 289410884,
TRAILER_PRESENT = 289410885,
+ VEHICLE_CURB_WEIGHT = 289410886,
}
diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp
index cb92c6b..5284a0a 100644
--- a/automotive/vehicle/aidl/aidl_test/Android.bp
+++ b/automotive/vehicle/aidl/aidl_test/Android.bp
@@ -26,7 +26,7 @@
"libhidlbase",
],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"android.hardware.automotive.vehicle@2.0",
"libgtest",
"libgmock",
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 9dbeae2..727b949 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -2815,4 +2815,29 @@
*/
TRAILER_PRESENT = 0x0F45 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+
+ /**
+ * Vehicle’s curb weight
+ *
+ * Returns the vehicle's curb weight in kilograms. Curb weight is
+ * the total weight of the vehicle with standard equipment and all
+ * necessary operating consumables such as motor oil,transmission oil,
+ * brake fluid, coolant, air conditioning refrigerant, and weight of
+ * fuel at nominal tank capacity, while not loaded with either passengers
+ * or cargo.
+ *
+ * configArray[0] is used to specify the vehicle’s gross weight in kilograms.
+ * The vehicle’s gross weight is the maximum operating weight of the vehicle
+ * as specified by the manufacturer including the vehicle's chassis, body, engine,
+ * engine fluids, fuel, accessories, driver, passengers and cargo but excluding
+ * that of any trailers.
+ *
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:KILOGRAM
+ */
+
+ VEHICLE_CURB_WEIGHT = 0x0F46 + 0x10000000 + 0x01000000
+ + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+
}
diff --git a/automotive/vehicle/aidl/impl/Android.bp b/automotive/vehicle/aidl/impl/Android.bp
index 16b6fde..d24a739 100644
--- a/automotive/vehicle/aidl/impl/Android.bp
+++ b/automotive/vehicle/aidl/impl/Android.bp
@@ -21,7 +21,7 @@
cc_defaults {
name: "VehicleHalDefaults",
static_libs: [
- "android-automotive-large-parcelable-vendor-lib",
+ "android-automotive-large-parcelable-lib",
"android.hardware.automotive.vehicle-V1-ndk",
"libmath",
],
diff --git a/automotive/vehicle/aidl/impl/default_config/Android.bp b/automotive/vehicle/aidl/impl/default_config/Android.bp
index 7a98b64..0feaf23 100644
--- a/automotive/vehicle/aidl/impl/default_config/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/Android.bp
@@ -24,8 +24,8 @@
local_include_dirs: ["include"],
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
- static_libs: ["VehicleHalUtilsVendor"],
+ static_libs: ["VehicleHalUtils"],
header_libs: ["VehicleHalTestUtilHeaders"],
- export_static_lib_headers: ["VehicleHalUtilsVendor"],
+ export_static_lib_headers: ["VehicleHalUtils"],
export_header_lib_headers: ["VehicleHalTestUtilHeaders"],
}
diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h
index d2b69af..6ecac70 100644
--- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h
+++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h
@@ -754,8 +754,7 @@
{.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
.access = VehiclePropertyAccess::READ,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {3}},
- .initialValue = {.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}}},
+ .configArray = {3}}},
{.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
.access = VehiclePropertyAccess::READ_WRITE,
diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
index 0c4a3a4..771472c 100644
--- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
@@ -24,7 +24,7 @@
defaults: ["VehicleHalDefaults"],
srcs: ["*.cpp"],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"libgtest",
],
header_libs: [
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp
index e6c4ee9..ab223d3 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp
@@ -26,7 +26,7 @@
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"FakeObd2Frame",
],
shared_libs: [
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/FakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/FakeValueGenerator.h
index 93ffebf..5c90c30 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/FakeValueGenerator.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/FakeValueGenerator.h
@@ -33,7 +33,7 @@
virtual ~FakeValueGenerator() = default;
// Returns the next event if there is one or {@code std::nullopt} if there is none.
- virtual std::optional<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>
+ virtual std::optional<aidl::android::hardware::automotive::vehicle::VehiclePropValue>
nextEvent() = 0;
};
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 ad04d23..9f112ae 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h
@@ -44,7 +44,7 @@
class GeneratorHub {
public:
using OnHalEvent = std::function<void(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& event)>;
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& event)>;
explicit GeneratorHub(OnHalEvent&& onHalEvent);
~GeneratorHub();
@@ -60,7 +60,7 @@
private:
struct VhalEvent {
int32_t generatorId;
- ::aidl::android::hardware::automotive::vehicle::VehiclePropValue val;
+ aidl::android::hardware::automotive::vehicle::VehiclePropValue val;
};
// Comparator used by priority queue to keep track of soonest event.
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 8116ed2..947eb4f 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h
@@ -37,7 +37,7 @@
// {@code int32Values} has less than 2 elements, number of iterations would be set to -1, which
// means iterate indefinitely.
explicit JsonFakeValueGenerator(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& request);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request);
// Create a new JSON fake value generator using the specified JSON file path. All the events
// in the JSON file would be generated for number of {@code iteration}. If iteration is 0, no
// value would be generated. If iteration is less than 0, it would iterate indefinitely.
@@ -48,14 +48,14 @@
~JsonFakeValueGenerator() = default;
- std::optional<::aidl::android::hardware::automotive::vehicle::VehiclePropValue> nextEvent()
+ std::optional<aidl::android::hardware::automotive::vehicle::VehiclePropValue> nextEvent()
override;
- const std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue>&
getAllEvents();
private:
size_t mEventIndex = 0;
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropValue> mEvents;
+ std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue> mEvents;
long mLastEventTimestamp = 0;
int32_t mNumOfIterations = 0;
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/LinearFakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/LinearFakeValueGenerator.h
index bd004f3..d2b701d 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/LinearFakeValueGenerator.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/LinearFakeValueGenerator.h
@@ -35,7 +35,7 @@
// int64Values[0]: interval
// {@code propId} must be INT32 or INT64 or FLOAT type.
explicit LinearFakeValueGenerator(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& request);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request);
// A linear value generator in range [middleValue - dispersion, middleValue + dispersion),
// starts at 'currentValue' and at each 'interval', increase by 'increment' and loop back if
// exceeds middleValue + dispersion. {@code propId} must be INT32 or INT64 or FLOAT type.
@@ -43,7 +43,7 @@
float dispersion, float increment, int64_t interval);
~LinearFakeValueGenerator() = default;
- std::optional<::aidl::android::hardware::automotive::vehicle::VehiclePropValue> nextEvent()
+ std::optional<aidl::android::hardware::automotive::vehicle::VehiclePropValue> nextEvent()
override;
private:
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 58f0e98..ac8db44 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
@@ -24,7 +24,7 @@
srcs: ["*.cpp"],
defaults: ["VehicleHalDefaults"],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"FakeVehicleHalValueGenerators",
"FakeObd2Frame",
],
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
index 49f7671..dcd9208 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
@@ -39,7 +39,7 @@
],
export_header_lib_headers: ["IVehicleHardware"],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"FakeVehicleHalValueGenerators",
"FakeObd2Frame",
"FakeUserHal",
@@ -47,5 +47,5 @@
shared_libs: [
"libjsoncpp",
],
- export_static_lib_headers: ["VehicleHalUtilsVendor"],
+ export_static_lib_headers: ["VehicleHalUtils"],
}
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 578d045..9634c80 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
@@ -46,30 +46,30 @@
explicit FakeVehicleHardware(std::unique_ptr<VehiclePropValuePool> valuePool);
// Get all the property configs.
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropConfig>
+ std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropConfig>
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.
- ::aidl::android::hardware::automotive::vehicle::StatusCode setValues(
+ aidl::android::hardware::automotive::vehicle::StatusCode setValues(
std::shared_ptr<const SetValuesCallback> callback,
- const std::vector<::aidl::android::hardware::automotive::vehicle::SetValueRequest>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::SetValueRequest>&
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.
- ::aidl::android::hardware::automotive::vehicle::StatusCode getValues(
+ aidl::android::hardware::automotive::vehicle::StatusCode getValues(
std::shared_ptr<const GetValuesCallback> callback,
- const std::vector<::aidl::android::hardware::automotive::vehicle::GetValueRequest>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::GetValueRequest>&
requests) const override;
// Dump debug information in the server.
DumpResult dump(const std::vector<std::string>& options) override;
// Check whether the system is healthy, return {@code StatusCode::OK} for healthy.
- ::aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() override;
+ aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() override;
// Register a callback that would be called when there is a property change event from vehicle.
void registerOnPropertyChangeEvent(
@@ -85,11 +85,11 @@
const std::shared_ptr<VehiclePropValuePool> mValuePool;
const std::shared_ptr<VehiclePropertyStore> mServerSidePropStore;
- ::android::base::Result<VehiclePropValuePool::RecyclableType> getValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
+ android::base::Result<VehiclePropValuePool::RecyclableType> getValue(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
- ::android::base::Result<void> setValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ android::base::Result<void> setValue(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
private:
// Expose private methods to unit test.
@@ -108,33 +108,33 @@
void storePropInitialValue(const defaultconfig::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);
+ 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);
- ::android::base::Result<void> maybeSetSpecialValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
+ android::base::Result<void> maybeSetSpecialValue(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
bool* isSpecialValue);
- ::android::base::Result<VehiclePropValuePool::RecyclableType> maybeGetSpecialValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
+ android::base::Result<VehiclePropValuePool::RecyclableType> maybeGetSpecialValue(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
bool* isSpecialValue) const;
- ::android::base::Result<void> setApPowerStateReport(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ android::base::Result<void> setApPowerStateReport(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
VehiclePropValuePool::RecyclableType createApPowerStateReq(
- ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq state);
- ::android::base::Result<void> setUserHalProp(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
- ::android::base::Result<VehiclePropValuePool::RecyclableType> getUserHalProp(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
+ aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq state);
+ android::base::Result<void> setUserHalProp(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ android::base::Result<VehiclePropValuePool::RecyclableType> getUserHalProp(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
bool isHvacPropAndHvacNotAvailable(int32_t propId);
std::string dumpAllProperties();
std::string dumpOnePropertyByConfig(
int rowNumber,
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config);
std::string dumpOnePropertyById(int32_t propId, int32_t areaId);
std::string dumpHelp();
std::string dumpListProperties();
@@ -142,23 +142,23 @@
std::string dumpSetProperties(const std::vector<std::string>& options);
template <typename T>
- ::android::base::Result<T> safelyParseInt(int index, const std::string& s) {
+ android::base::Result<T> safelyParseInt(int index, const std::string& s) {
T out;
if (!::android::base::ParseInt(s, &out)) {
- return ::android::base::Error() << ::android::base::StringPrintf(
+ return android::base::Error() << android::base::StringPrintf(
"non-integer argument at index %d: %s\n", index, s.c_str());
}
return out;
}
- ::android::base::Result<float> safelyParseFloat(int index, const std::string& s);
+ android::base::Result<float> safelyParseFloat(int index, const std::string& s);
std::vector<std::string> getOptionValues(const std::vector<std::string>& options,
size_t* index);
- ::android::base::Result<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>
+ android::base::Result<aidl::android::hardware::automotive::vehicle::VehiclePropValue>
parseSetPropOptions(const std::vector<std::string>& options);
- ::android::base::Result<std::vector<uint8_t>> parseHexString(const std::string& s);
+ android::base::Result<std::vector<uint8_t>> parseHexString(const std::string& s);
- ::android::base::Result<void> checkArgumentsSize(const std::vector<std::string>& options,
- size_t minSize);
+ android::base::Result<void> checkArgumentsSize(const std::vector<std::string>& options,
+ size_t minSize);
};
} // namespace fake
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 9f679bc..90d1516 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
@@ -29,7 +29,7 @@
"VehicleHalTestUtilHeaders",
],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"FakeVehicleHardware",
"FakeVehicleHalValueGenerators",
"FakeObd2Frame",
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 0812c2a..3dae9fc 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
@@ -58,7 +58,6 @@
using ::testing::ContainerEq;
using ::testing::ContainsRegex;
using ::testing::Eq;
-using ::testing::IsSubsetOf;
using ::testing::WhenSortedBy;
constexpr int INVALID_PROP_ID = 0;
@@ -635,16 +634,16 @@
.expectedValuesToGet =
{
VehiclePropValue{
- .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
- .value.int32Values = {toInt(
- VehicleApPowerStateReport::DEEP_SLEEP_EXIT)},
- },
- VehiclePropValue{
.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
.status = VehiclePropertyStatus::AVAILABLE,
.value.int32Values = {toInt(VehicleApPowerStateReq::ON),
0},
},
+ VehiclePropValue{
+ .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
+ .value.int32Values = {toInt(
+ VehicleApPowerStateReport::DEEP_SLEEP_EXIT)},
+ },
},
},
SetSpecialValueTestCase{
@@ -660,16 +659,16 @@
.expectedValuesToGet =
{
VehiclePropValue{
- .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
- .value.int32Values = {toInt(
- VehicleApPowerStateReport::HIBERNATION_EXIT)},
- },
- VehiclePropValue{
.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
.status = VehiclePropertyStatus::AVAILABLE,
.value.int32Values = {toInt(VehicleApPowerStateReq::ON),
0},
},
+ VehiclePropValue{
+ .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
+ .value.int32Values = {toInt(
+ VehicleApPowerStateReport::HIBERNATION_EXIT)},
+ },
},
},
SetSpecialValueTestCase{
@@ -685,16 +684,16 @@
.expectedValuesToGet =
{
VehiclePropValue{
- .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
- .value.int32Values = {toInt(
- VehicleApPowerStateReport::SHUTDOWN_CANCELLED)},
- },
- VehiclePropValue{
.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
.status = VehiclePropertyStatus::AVAILABLE,
.value.int32Values = {toInt(VehicleApPowerStateReq::ON),
0},
},
+ VehiclePropValue{
+ .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
+ .value.int32Values = {toInt(
+ VehicleApPowerStateReport::SHUTDOWN_CANCELLED)},
+ },
},
},
SetSpecialValueTestCase{
@@ -710,16 +709,16 @@
.expectedValuesToGet =
{
VehiclePropValue{
- .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
- .value.int32Values = {toInt(
- VehicleApPowerStateReport::WAIT_FOR_VHAL)},
- },
- VehiclePropValue{
.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
.status = VehiclePropertyStatus::AVAILABLE,
.value.int32Values = {toInt(VehicleApPowerStateReq::ON),
0},
},
+ VehiclePropValue{
+ .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
+ .value.int32Values = {toInt(
+ VehicleApPowerStateReport::WAIT_FOR_VHAL)},
+ },
},
},
SetSpecialValueTestCase{
@@ -735,16 +734,16 @@
.expectedValuesToGet =
{
VehiclePropValue{
- .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
- .value.int32Values = {toInt(
- VehicleApPowerStateReport::DEEP_SLEEP_ENTRY)},
- },
- VehiclePropValue{
.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
.status = VehiclePropertyStatus::AVAILABLE,
.value.int32Values =
{toInt(VehicleApPowerStateReq::FINISHED), 0},
},
+ VehiclePropValue{
+ .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
+ .value.int32Values = {toInt(
+ VehicleApPowerStateReport::DEEP_SLEEP_ENTRY)},
+ },
},
},
SetSpecialValueTestCase{
@@ -760,16 +759,16 @@
.expectedValuesToGet =
{
VehiclePropValue{
- .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
- .value.int32Values = {toInt(
- VehicleApPowerStateReport::HIBERNATION_ENTRY)},
- },
- VehiclePropValue{
.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
.status = VehiclePropertyStatus::AVAILABLE,
.value.int32Values =
{toInt(VehicleApPowerStateReq::FINISHED), 0},
},
+ VehiclePropValue{
+ .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
+ .value.int32Values = {toInt(
+ VehicleApPowerStateReport::HIBERNATION_ENTRY)},
+ },
},
},
SetSpecialValueTestCase{
@@ -785,16 +784,16 @@
.expectedValuesToGet =
{
VehiclePropValue{
- .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
- .value.int32Values = {toInt(
- VehicleApPowerStateReport::SHUTDOWN_START)},
- },
- VehiclePropValue{
.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
.status = VehiclePropertyStatus::AVAILABLE,
.value.int32Values =
{toInt(VehicleApPowerStateReq::FINISHED), 0},
},
+ VehiclePropValue{
+ .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
+ .value.int32Values = {toInt(
+ VehicleApPowerStateReport::SHUTDOWN_START)},
+ },
},
},
SetSpecialValueTestCase{
@@ -915,7 +914,7 @@
// 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, IsSubsetOf(gotValues)));
+ ASSERT_THAT(getChangedProperties(), WhenSortedBy(mPropValueCmp, Eq(gotValues)));
}
INSTANTIATE_TEST_SUITE_P(
diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp
index c21ad53..c1cee84 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp
@@ -26,7 +26,7 @@
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
],
- export_static_lib_headers: ["VehicleHalUtilsVendor"],
+ export_static_lib_headers: ["VehicleHalUtils"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/FakeObd2Frame.h b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/FakeObd2Frame.h
index 118bb34..fa6d8f9 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/FakeObd2Frame.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/FakeObd2Frame.h
@@ -35,17 +35,17 @@
: mPropStore(propStore) {}
void initObd2LiveFrame(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig);
void initObd2FreezeFrame(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig);
- ::android::base::Result<VehiclePropValuePool::RecyclableType> getObd2FreezeFrame(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue&
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig);
+ android::base::Result<VehiclePropValuePool::RecyclableType> getObd2FreezeFrame(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue&
requestedPropValue) const;
- ::android::base::Result<VehiclePropValuePool::RecyclableType> getObd2DtcInfo() const;
- ::android::base::Result<void> clearObd2FreezeFrames(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+ android::base::Result<VehiclePropValuePool::RecyclableType> getObd2DtcInfo() const;
+ android::base::Result<void> clearObd2FreezeFrames(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
static bool isDiagnosticProperty(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig);
private:
std::shared_ptr<VehiclePropertyStore> mPropStore;
diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/Obd2SensorStore.h b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/Obd2SensorStore.h
index f6075cb..1395eae 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/Obd2SensorStore.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/Obd2SensorStore.h
@@ -45,7 +45,7 @@
template <class T>
static int getLastIndex() {
- auto range = ::ndk::enum_range<T>();
+ auto range = ndk::enum_range<T>();
auto it = range.begin();
while (std::next(it) != range.end()) {
it++;
@@ -54,19 +54,19 @@
}
// Stores an integer-valued sensor.
- ::aidl::android::hardware::automotive::vehicle::StatusCode setIntegerSensor(
- ::aidl::android::hardware::automotive::vehicle::DiagnosticIntegerSensorIndex index,
+ aidl::android::hardware::automotive::vehicle::StatusCode setIntegerSensor(
+ aidl::android::hardware::automotive::vehicle::DiagnosticIntegerSensorIndex index,
int32_t value);
// Stores an integer-valued sensor.
- ::aidl::android::hardware::automotive::vehicle::StatusCode setIntegerSensor(size_t index,
- int32_t value);
+ aidl::android::hardware::automotive::vehicle::StatusCode setIntegerSensor(size_t index,
+ int32_t value);
// Stores a float-valued sensor.
- ::aidl::android::hardware::automotive::vehicle::StatusCode setFloatSensor(
- ::aidl::android::hardware::automotive::vehicle::DiagnosticFloatSensorIndex index,
+ aidl::android::hardware::automotive::vehicle::StatusCode setFloatSensor(
+ aidl::android::hardware::automotive::vehicle::DiagnosticFloatSensorIndex index,
float value);
// Stores a float-valued sensor.
- ::aidl::android::hardware::automotive::vehicle::StatusCode setFloatSensor(size_t index,
- float value);
+ aidl::android::hardware::automotive::vehicle::StatusCode setFloatSensor(size_t index,
+ float value);
// Returns a sensor property value using the given DTC.
VehiclePropValuePool::RecyclableType getSensorProperty(const std::string& dtc) const;
@@ -76,8 +76,8 @@
public:
explicit BitmaskInVector(size_t numBits = 0);
void resize(size_t numBits);
- ::android::base::Result<bool> get(size_t index) const;
- ::android::base::Result<void> set(size_t index, bool value);
+ android::base::Result<bool> get(size_t index) const;
+ android::base::Result<void> set(size_t index, bool value);
const std::vector<uint8_t>& getBitmask() const;
diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
index a16185b..55b8c93 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
@@ -25,7 +25,7 @@
defaults: ["VehicleHalDefaults"],
static_libs: [
"FakeObd2Frame",
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
],
test_suites: ["device-tests"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp
index 1689102..2e95531 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp
@@ -26,7 +26,7 @@
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
],
- export_static_lib_headers: ["VehicleHalUtilsVendor"],
+ export_static_lib_headers: ["VehicleHalUtils"],
}
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 1424c81..a220146 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h
@@ -49,13 +49,13 @@
//
// @return updated property and StatusCode
android::base::Result<VehiclePropValuePool::RecyclableType> onSetProperty(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
// Gets the property value from the emulator.
//
// @return property value and StatusCode
android::base::Result<VehiclePropValuePool::RecyclableType> onGetProperty(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
// Shows the User HAL emulation help.
std::string showDumpHelp() const;
@@ -94,30 +94,30 @@
// test this error scenario)
// - if it's 3, then don't send a property change (so Android can emulate a timeout)
android::base::Result<VehiclePropValuePool::RecyclableType> onSetInitialUserInfoResponse(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
// Used to emulate SWITCH_USER - see onSetInitialUserInfoResponse() for usage.
android::base::Result<VehiclePropValuePool::RecyclableType> onSetSwitchUserResponse(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
// Used to emulate CREATE_USER - see onSetInitialUserInfoResponse() for usage.
android::base::Result<VehiclePropValuePool::RecyclableType> onSetCreateUserResponse(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
// Used to emulate set USER_IDENTIFICATION_ASSOCIATION - see onSetInitialUserInfoResponse() for
// usage.
android::base::Result<VehiclePropValuePool::RecyclableType> onSetUserIdentificationAssociation(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
// Used to emulate get USER_IDENTIFICATION_ASSOCIATION - see onSetInitialUserInfoResponse() for
// usage.
android::base::Result<VehiclePropValuePool::RecyclableType> onGetUserIdentificationAssociation(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
// Creates a default USER_IDENTIFICATION_ASSOCIATION when it was not set by lshal.
static android::base::Result<VehiclePropValuePool::RecyclableType>
defaultUserIdentificationAssociation(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& request);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request);
android::base::Result<VehiclePropValuePool::RecyclableType> sendUserHalResponse(
VehiclePropValuePool::RecyclableType response, int32_t requestId);
diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalHelper.h b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalHelper.h
index 5be13be..104876c 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalHelper.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalHelper.h
@@ -35,48 +35,46 @@
// Verify whether the |value| can be casted to the type |T| and return the casted value on success.
// Otherwise, return the error.
template <typename T>
-::android::base::Result<T> verifyAndCast(int32_t value);
+android::base::Result<T> verifyAndCast(int32_t value);
// Below functions parse VehiclePropValues to the respective User HAL request structs. On success,
// these functions return the User HAL struct. Otherwise, they return the error.
-::android::base::Result<::aidl::android::hardware::automotive::vehicle::InitialUserInfoRequest>
+android::base::Result<aidl::android::hardware::automotive::vehicle::InitialUserInfoRequest>
toInitialUserInfoRequest(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
-::android::base::Result<::aidl::android::hardware::automotive::vehicle::SwitchUserRequest>
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+android::base::Result<aidl::android::hardware::automotive::vehicle::SwitchUserRequest>
toSwitchUserRequest(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
-::android::base::Result<::aidl::android::hardware::automotive::vehicle::CreateUserRequest>
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+android::base::Result<aidl::android::hardware::automotive::vehicle::CreateUserRequest>
toCreateUserRequest(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
-::android::base::Result<::aidl::android::hardware::automotive::vehicle::RemoveUserRequest>
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+android::base::Result<aidl::android::hardware::automotive::vehicle::RemoveUserRequest>
toRemoveUserRequest(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
-::android::base::Result<
- ::aidl::android::hardware::automotive::vehicle::UserIdentificationGetRequest>
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+android::base::Result<aidl::android::hardware::automotive::vehicle::UserIdentificationGetRequest>
toUserIdentificationGetRequest(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
-::android::base::Result<
- ::aidl::android::hardware::automotive::vehicle::UserIdentificationSetRequest>
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+android::base::Result<aidl::android::hardware::automotive::vehicle::UserIdentificationSetRequest>
toUserIdentificationSetRequest(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
// Below functions convert the User HAL structs to VehiclePropValues. On success, these functions
// return the pointer to VehiclePropValue. Otherwise, they return the error.
-::android::base::Result<VehiclePropValuePool::RecyclableType> toVehiclePropValue(
+android::base::Result<VehiclePropValuePool::RecyclableType> toVehiclePropValue(
VehiclePropValuePool& pool,
- const ::aidl::android::hardware::automotive::vehicle::SwitchUserRequest& request);
+ const aidl::android::hardware::automotive::vehicle::SwitchUserRequest& request);
VehiclePropValuePool::RecyclableType toVehiclePropValue(
VehiclePropValuePool& pool,
- const ::aidl::android::hardware::automotive::vehicle::InitialUserInfoResponse& response);
+ const aidl::android::hardware::automotive::vehicle::InitialUserInfoResponse& response);
VehiclePropValuePool::RecyclableType toVehiclePropValue(
VehiclePropValuePool& pool,
- const ::aidl::android::hardware::automotive::vehicle::SwitchUserResponse& response);
+ const aidl::android::hardware::automotive::vehicle::SwitchUserResponse& response);
VehiclePropValuePool::RecyclableType toVehiclePropValue(
VehiclePropValuePool& pool,
- const ::aidl::android::hardware::automotive::vehicle::CreateUserResponse& response);
+ const aidl::android::hardware::automotive::vehicle::CreateUserResponse& response);
VehiclePropValuePool::RecyclableType toVehiclePropValue(
VehiclePropValuePool& pool,
- const ::aidl::android::hardware::automotive::vehicle::UserIdentificationResponse& response);
+ const aidl::android::hardware::automotive::vehicle::UserIdentificationResponse& response);
} // namespace user_hal_helper
} // namespace fake
diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
index 1471ea6..7d0a534 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
@@ -25,7 +25,7 @@
defaults: ["VehicleHalDefaults"],
static_libs: [
"FakeUserHal",
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"libgtest",
"libgmock",
],
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 6209880..7670c25 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
@@ -34,10 +34,10 @@
shared_libs: ["libprotobuf-cpp-full"],
static_libs: [
"VehicleHalProtos",
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
],
defaults: ["VehicleHalDefaults"],
- export_static_lib_headers: ["VehicleHalUtilsVendor"],
+ export_static_lib_headers: ["VehicleHalUtils"],
}
cc_test {
@@ -51,7 +51,7 @@
static_libs: [
"VehicleHalProtoMessageConverter",
"VehicleHalProtos",
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"libgtest",
],
header_libs: ["VehicleHalDefaultConfig"],
diff --git a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h
index 4b9de2d..4a38827 100644
--- a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h
@@ -39,7 +39,7 @@
// A structure to represent a set value error event reported from vehicle.
struct SetValueErrorEvent {
- ::aidl::android::hardware::automotive::vehicle::StatusCode errorCode;
+ aidl::android::hardware::automotive::vehicle::StatusCode errorCode;
int32_t propId;
int32_t areaId;
};
@@ -51,40 +51,40 @@
class IVehicleHardware {
public:
using SetValuesCallback = std::function<void(
- std::vector<::aidl::android::hardware::automotive::vehicle::SetValueResult>)>;
+ std::vector<aidl::android::hardware::automotive::vehicle::SetValueResult>)>;
using GetValuesCallback = std::function<void(
- std::vector<::aidl::android::hardware::automotive::vehicle::GetValueResult>)>;
+ std::vector<aidl::android::hardware::automotive::vehicle::GetValueResult>)>;
using PropertyChangeCallback = std::function<void(
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>)>;
+ std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue>)>;
using PropertySetErrorCallback = std::function<void(std::vector<SetValueErrorEvent>)>;
virtual ~IVehicleHardware() = default;
// Get all the property configs.
- virtual std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropConfig>
+ virtual std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropConfig>
getAllPropertyConfigs() const = 0;
// 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.
- virtual ::aidl::android::hardware::automotive::vehicle::StatusCode setValues(
+ virtual aidl::android::hardware::automotive::vehicle::StatusCode setValues(
std::shared_ptr<const SetValuesCallback> callback,
- const std::vector<::aidl::android::hardware::automotive::vehicle::SetValueRequest>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::SetValueRequest>&
requests) = 0;
// 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.
- virtual ::aidl::android::hardware::automotive::vehicle::StatusCode getValues(
+ virtual aidl::android::hardware::automotive::vehicle::StatusCode getValues(
std::shared_ptr<const GetValuesCallback> callback,
- const std::vector<::aidl::android::hardware::automotive::vehicle::GetValueRequest>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::GetValueRequest>&
requests) const = 0;
// Dump debug information in the server.
virtual DumpResult dump(const std::vector<std::string>& options) = 0;
// Check whether the system is healthy, return {@code StatusCode::OK} for healthy.
- virtual ::aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() = 0;
+ 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.
virtual void registerOnPropertyChangeEvent(
diff --git a/automotive/vehicle/aidl/impl/utils/common/Android.bp b/automotive/vehicle/aidl/impl/utils/common/Android.bp
index 88713f1..e5d9346 100644
--- a/automotive/vehicle/aidl/impl/utils/common/Android.bp
+++ b/automotive/vehicle/aidl/impl/utils/common/Android.bp
@@ -19,41 +19,14 @@
}
cc_library {
- name: "VehicleHalUtilsVendor",
+ name: "VehicleHalUtils",
srcs: ["src/*.cpp"],
- vendor: true,
+ vendor_available: true,
local_include_dirs: ["include"],
export_include_dirs: ["include"],
defaults: ["VehicleHalDefaults"],
}
-// This is a non-vendor version for VehicleHalUtilsVendor.
-cc_library {
- name: "VehicleHalUtils",
- srcs: ["src/*.cpp"],
- local_include_dirs: ["include"],
- export_include_dirs: ["include"],
- static_libs: [
- "android-automotive-large-parcelable-lib",
- "android.hardware.automotive.vehicle-V1-ndk",
- "libmath",
- ],
- shared_libs: [
- "libbase",
- "liblog",
- "libutils",
- ],
- cflags: [
- "-Wall",
- "-Wextra",
- "-Werror",
- "-Wthread-safety",
- ],
- defaults: [
- "android-automotive-large-parcelable-defaults",
- ],
-}
-
cc_library_headers {
name: "VehicleHalUtilHeaders",
export_include_dirs: ["include"],
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h b/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h
index 9a8f19b..08b56a6 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h
@@ -35,7 +35,7 @@
public:
void waitForItems() {
std::unique_lock<std::mutex> lockGuard(mLock);
- ::android::base::ScopedLockAssertion lockAssertion(mLock);
+ android::base::ScopedLockAssertion lockAssertion(mLock);
while (mQueue.empty() && mIsActive) {
mCond.wait(lockGuard);
}
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/ParcelableUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/ParcelableUtils.h
index 7b2111b..ab7b895 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/ParcelableUtils.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/ParcelableUtils.h
@@ -33,13 +33,13 @@
// If values is small enough, it would be put into output.payloads, otherwise a shared memory file
// would be created and output.sharedMemoryFd would be filled in.
template <class T1, class T2>
-::ndk::ScopedAStatus vectorToStableLargeParcelable(std::vector<T1>&& values, T2* output) {
+ndk::ScopedAStatus vectorToStableLargeParcelable(std::vector<T1>&& values, T2* output) {
output->payloads = std::move(values);
- auto result = ::android::automotive::car_binder_lib::LargeParcelableBase::
+ auto result = android::automotive::car_binder_lib::LargeParcelableBase::
parcelableToStableLargeParcelable(*output);
if (!result.ok()) {
return toScopedAStatus(
- result, ::aidl::android::hardware::automotive::vehicle::StatusCode::INTERNAL_ERROR);
+ result, aidl::android::hardware::automotive::vehicle::StatusCode::INTERNAL_ERROR);
}
auto& fd = result.value();
if (fd != nullptr) {
@@ -48,14 +48,14 @@
output->payloads.clear();
output->sharedMemoryFd = std::move(*fd);
} else {
- output->sharedMemoryFd = ::ndk::ScopedFileDescriptor();
+ output->sharedMemoryFd = ndk::ScopedFileDescriptor();
// Do not modify payloads.
}
- return ::ndk::ScopedAStatus::ok();
+ return ndk::ScopedAStatus::ok();
}
template <class T1, class T2>
-::ndk::ScopedAStatus vectorToStableLargeParcelable(const std::vector<T1>& values, T2* output) {
+ndk::ScopedAStatus vectorToStableLargeParcelable(const std::vector<T1>& values, T2* output) {
// Because 'values' is passed in as const reference, we have to do a copy here.
std::vector<T1> valuesCopy = values;
@@ -63,16 +63,16 @@
}
template <class T>
-::android::base::expected<
- ::android::automotive::car_binder_lib::LargeParcelableBase::BorrowedOwnedObject<T>,
- ::ndk::ScopedAStatus>
+android::base::expected<
+ android::automotive::car_binder_lib::LargeParcelableBase::BorrowedOwnedObject<T>,
+ ndk::ScopedAStatus>
fromStableLargeParcelable(const T& largeParcelable) {
- auto result = ::android::automotive::car_binder_lib::LargeParcelableBase::
+ auto result = android::automotive::car_binder_lib::LargeParcelableBase::
stableLargeParcelableToParcelable(largeParcelable);
if (!result.ok()) {
- return ::android::base::unexpected(toScopedAStatus(
- result, ::aidl::android::hardware::automotive::vehicle::StatusCode::INVALID_ARG,
+ return android::base::unexpected(toScopedAStatus(
+ result, aidl::android::hardware::automotive::vehicle::StatusCode::INVALID_ARG,
"failed to parse large parcelable"));
}
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h
index 4b2a11a..6e812d1 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h
@@ -168,7 +168,7 @@
class VehiclePropValuePool {
public:
using RecyclableType =
- recyclable_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>;
+ recyclable_ptr<aidl::android::hardware::automotive::vehicle::VehiclePropValue>;
// Creates VehiclePropValuePool
//
@@ -188,20 +188,20 @@
// given type is not MIXED or STRING, the internal value vector size would be set to 1.
// If the given type is MIXED or STRING, all the internal vector sizes would be initialized to
// 0.
- RecyclableType obtain(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type);
+ RecyclableType obtain(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type);
// Obtain a recyclable VehiclePropertyValue object from the pool for the given type. If the
// given type is *_VEC or BYTES, the internal value vector size would be set to vectorSize. If
// the given type is BOOLEAN, INT32, FLOAT, or INT64, the internal value vector size would be
// set to 1. If the given type is MIXED or STRING, all the internal value vector sizes would be
// set to 0. vectorSize must be larger than 0.
- RecyclableType obtain(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ RecyclableType obtain(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
size_t vectorSize);
// Obtain a recyclable VehicePropertyValue object that is a copy of src. If src does not contain
// any value or the src property type is not valid, this function would return an empty
// VehiclePropValue.
RecyclableType obtain(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& src);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& src);
// Obtain a recyclable boolean object.
RecyclableType obtainBoolean(bool value);
// Obtain a recyclable int32 object.
@@ -220,36 +220,35 @@
private:
static inline bool isSingleValueType(
- ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
- return type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::
- BOOLEAN ||
- type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32 ||
- type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64 ||
- type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT;
+ aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
+ return type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN ||
+ type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32 ||
+ type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64 ||
+ type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT;
}
static inline bool isComplexType(
- ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
- return type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED ||
- type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING;
+ aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
+ return type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED ||
+ type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING;
}
- bool isDisposable(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ bool isDisposable(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
size_t vectorSize) const {
return vectorSize > mMaxRecyclableVectorSize || isComplexType(type);
}
RecyclableType obtainDisposable(
- ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType valueType,
+ aidl::android::hardware::automotive::vehicle::VehiclePropertyType valueType,
size_t vectorSize) const;
RecyclableType obtainRecyclable(
- ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
size_t vectorSize);
class InternalPool
- : public ObjectPool<::aidl::android::hardware::automotive::vehicle::VehiclePropValue> {
+ : public ObjectPool<aidl::android::hardware::automotive::vehicle::VehiclePropValue> {
public:
- InternalPool(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ InternalPool(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
size_t vectorSize, size_t maxPoolObjectsSize,
ObjectPool::GetSizeFunc getSizeFunc)
: ObjectPool(maxPoolObjectsSize, getSizeFunc),
@@ -257,11 +256,11 @@
mVectorSize(vectorSize) {}
protected:
- ::aidl::android::hardware::automotive::vehicle::VehiclePropValue* createObject() override;
- void recycle(::aidl::android::hardware::automotive::vehicle::VehiclePropValue* o) override;
+ aidl::android::hardware::automotive::vehicle::VehiclePropValue* createObject() override;
+ void recycle(aidl::android::hardware::automotive::vehicle::VehiclePropValue* o) override;
private:
- bool check(::aidl::android::hardware::automotive::vehicle::RawPropValues* v);
+ bool check(aidl::android::hardware::automotive::vehicle::RawPropValues* v);
template <typename VecType>
bool check(std::vector<VecType>* vec, bool isVectorType) {
@@ -269,12 +268,12 @@
}
private:
- ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType mPropType;
+ aidl::android::hardware::automotive::vehicle::VehiclePropertyType mPropType;
size_t mVectorSize;
};
- const Deleter<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>
+ const Deleter<aidl::android::hardware::automotive::vehicle::VehiclePropValue>
mDisposableDeleter{
- [](::aidl::android::hardware::automotive::vehicle::VehiclePropValue* v) {
+ [](aidl::android::hardware::automotive::vehicle::VehiclePropValue* v) {
delete v;
}};
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h
index 63129e7..2c7aa97 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h
@@ -49,18 +49,18 @@
// Callback when a property value has been updated or a new value added.
using OnValueChangeCallback = std::function<void(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue&)>;
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue&)>;
// Function that used to calculate unique token for given VehiclePropValue.
- using TokenFunction = ::std::function<int64_t(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value)>;
+ using TokenFunction = std::function<int64_t(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value)>;
// Register the given property according to the config. A property has to be registered first
// before write/read. If tokenFunc is not nullptr, it would be used to generate a unique
// property token to act as the key the property store. Otherwise, {propertyID, areaID} would be
// used as the key.
void registerProperty(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config,
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config,
TokenFunction tokenFunc = nullptr);
// Stores provided value. Returns error if config wasn't registered. If 'updateStatus' is
@@ -68,13 +68,13 @@
// 'status' would be initialized to {@code VehiclePropertyStatus::AVAILABLE}, if this is to
// override an existing value, the status for the existing value would be used for the
// overridden value.
- ::android::base::Result<void> writeValue(VehiclePropValuePool::RecyclableType propValue,
- bool updateStatus = false);
+ android::base::Result<void> writeValue(VehiclePropValuePool::RecyclableType propValue,
+ bool updateStatus = false);
// Remove a given property value from the property store. The 'propValue' would be used to
// generate the key for the value to remove.
void removeValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
// Remove all the values for the property.
void removeValuesForProperty(int32_t propId);
@@ -83,28 +83,28 @@
std::vector<VehiclePropValuePool::RecyclableType> readAllValues() const;
// Read all the values for the property.
- ::android::base::Result<std::vector<VehiclePropValuePool::RecyclableType>>
- readValuesForProperty(int32_t propId) const;
+ android::base::Result<std::vector<VehiclePropValuePool::RecyclableType>> readValuesForProperty(
+ int32_t propId) const;
// Read the value for the requested property. Returns {@code StatusCode::NOT_AVAILABLE} if the
// value has not been set yet. Returns {@code StatusCode::INVALID_ARG} if the property is
// not configured.
- ::android::base::Result<VehiclePropValuePool::RecyclableType> readValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& request) const;
+ android::base::Result<VehiclePropValuePool::RecyclableType> readValue(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request) const;
// Read the value for the requested property. Returns {@code StatusCode::NOT_AVAILABLE} if the
// value has not been set yet. Returns {@code StatusCode::INVALID_ARG} if the property is
// not configured.
- ::android::base::Result<VehiclePropValuePool::RecyclableType> readValue(
- int32_t prop, int32_t area = 0, int64_t token = 0) const;
+ android::base::Result<VehiclePropValuePool::RecyclableType> readValue(int32_t prop,
+ int32_t area = 0,
+ int64_t token = 0) const;
// Get all property configs.
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropConfig> getAllConfigs()
+ std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropConfig> getAllConfigs()
const;
// Get the property config for the requested property.
- ::android::base::Result<
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig*>
+ android::base::Result<const aidl::android::hardware::automotive::vehicle::VehiclePropConfig*>
getConfig(int32_t propId) const;
// Set a callback that would be called when a property value has been updated.
@@ -127,7 +127,7 @@
};
struct Record {
- ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig propConfig;
+ aidl::android::hardware::automotive::vehicle::VehiclePropConfig propConfig;
TokenFunction tokenFunction;
std::unordered_map<RecordId, VehiclePropValuePool::RecyclableType, RecordIdHash> values;
};
@@ -143,10 +143,10 @@
Record* getRecordLocked(int32_t propId);
RecordId getRecordIdLocked(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue,
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue,
const Record& record) const;
- ::android::base::Result<VehiclePropValuePool::RecyclableType> readValueLocked(
+ android::base::Result<VehiclePropValuePool::RecyclableType> readValueLocked(
const RecordId& recId, const Record& record) const;
};
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h
index 0f0ccf1..1fc5613 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h
@@ -37,38 +37,36 @@
return static_cast<U>(value);
}
-inline constexpr ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType getPropType(
+inline constexpr aidl::android::hardware::automotive::vehicle::VehiclePropertyType getPropType(
int32_t prop) {
- return static_cast<::aidl::android::hardware::automotive::vehicle::VehiclePropertyType>(
- prop &
- toInt(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MASK));
+ return static_cast<aidl::android::hardware::automotive::vehicle::VehiclePropertyType>(
+ prop & toInt(aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MASK));
}
-inline constexpr ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup getPropGroup(
+inline constexpr aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup getPropGroup(
int32_t prop) {
- return static_cast<::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup>(
- prop &
- toInt(::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup::MASK));
+ return static_cast<aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup>(
+ prop & toInt(aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup::MASK));
}
-inline constexpr ::aidl::android::hardware::automotive::vehicle::VehicleArea getPropArea(
+inline constexpr aidl::android::hardware::automotive::vehicle::VehicleArea getPropArea(
int32_t prop) {
- return static_cast<::aidl::android::hardware::automotive::vehicle::VehicleArea>(
- prop & toInt(::aidl::android::hardware::automotive::vehicle::VehicleArea::MASK));
+ return static_cast<aidl::android::hardware::automotive::vehicle::VehicleArea>(
+ prop & toInt(aidl::android::hardware::automotive::vehicle::VehicleArea::MASK));
}
inline constexpr bool isGlobalProp(int32_t prop) {
- return getPropArea(prop) == ::aidl::android::hardware::automotive::vehicle::VehicleArea::GLOBAL;
+ return getPropArea(prop) == aidl::android::hardware::automotive::vehicle::VehicleArea::GLOBAL;
}
inline constexpr bool isSystemProp(int32_t prop) {
- return ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup::SYSTEM ==
+ return aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup::SYSTEM ==
getPropGroup(prop);
}
-inline const ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* getAreaConfig(
+inline const aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* getAreaConfig(
int32_t propId, int32_t areaId,
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config) {
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config) {
if (config.areaConfigs.size() == 0) {
return nullptr;
}
@@ -85,43 +83,43 @@
return nullptr;
}
-inline const ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* getAreaConfig(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue,
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config) {
+inline const aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* getAreaConfig(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue,
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config) {
return getAreaConfig(propValue.prop, propValue.areaId, config);
}
-inline std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>
-createVehiclePropValueVec(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+inline std::unique_ptr<aidl::android::hardware::automotive::vehicle::VehiclePropValue>
+createVehiclePropValueVec(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
size_t vecSize) {
- auto val = std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>(
- new ::aidl::android::hardware::automotive::vehicle::VehiclePropValue);
+ auto val = std::unique_ptr<aidl::android::hardware::automotive::vehicle::VehiclePropValue>(
+ new aidl::android::hardware::automotive::vehicle::VehiclePropValue);
switch (type) {
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32:
[[fallthrough]];
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN:
vecSize = 1;
[[fallthrough]];
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32_VEC:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32_VEC:
val->value.int32Values.resize(vecSize);
break;
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT:
vecSize = 1;
[[fallthrough]];
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT_VEC:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT_VEC:
val->value.floatValues.resize(vecSize);
break;
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64:
vecSize = 1;
[[fallthrough]];
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64_VEC:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64_VEC:
val->value.int64Values.resize(vecSize);
break;
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BYTES:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BYTES:
val->value.byteValues.resize(vecSize);
break;
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING:
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED:
break; // Valid, but nothing to do.
default:
ALOGE("createVehiclePropValue: unknown type: %d", toInt(type));
@@ -130,34 +128,34 @@
return val;
}
-inline std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>
-createVehiclePropValue(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
+inline std::unique_ptr<aidl::android::hardware::automotive::vehicle::VehiclePropValue>
+createVehiclePropValue(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
return createVehiclePropValueVec(type, 1);
}
inline size_t getVehicleRawValueVectorSize(
- const ::aidl::android::hardware::automotive::vehicle::RawPropValues& value,
- ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
+ const aidl::android::hardware::automotive::vehicle::RawPropValues& value,
+ aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
switch (type) {
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32:
[[fallthrough]];
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN:
return std::min(value.int32Values.size(), static_cast<size_t>(1));
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT:
return std::min(value.floatValues.size(), static_cast<size_t>(1));
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64:
return std::min(value.int64Values.size(), static_cast<size_t>(1));
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32_VEC:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32_VEC:
return value.int32Values.size();
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT_VEC:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT_VEC:
return value.floatValues.size();
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64_VEC:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64_VEC:
return value.int64Values.size();
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BYTES:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BYTES:
return value.byteValues.size();
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING:
[[fallthrough]];
- case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED:
+ case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED:
return 0;
default:
ALOGE("getVehicleRawValueVectorSize: unknown type: %d", toInt(type));
@@ -166,8 +164,8 @@
}
inline void copyVehicleRawValue(
- ::aidl::android::hardware::automotive::vehicle::RawPropValues* dest,
- const ::aidl::android::hardware::automotive::vehicle::RawPropValues& src) {
+ aidl::android::hardware::automotive::vehicle::RawPropValues* dest,
+ const aidl::android::hardware::automotive::vehicle::RawPropValues& src) {
dest->int32Values = src.int32Values;
dest->floatValues = src.floatValues;
dest->int64Values = src.int64Values;
@@ -178,7 +176,7 @@
// getVehiclePropValueSize returns approximately how much memory 'value' would take. This should
// only be used in a limited-size memory pool to set an upper bound for memory consumption.
inline size_t getVehiclePropValueSize(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& prop) {
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& prop) {
size_t size = 0;
size += sizeof(prop.timestamp);
size += sizeof(prop.areaId);
@@ -193,22 +191,22 @@
}
template <class T>
-::aidl::android::hardware::automotive::vehicle::StatusCode getErrorCode(
- const ::android::base::Result<T>& result) {
+aidl::android::hardware::automotive::vehicle::StatusCode getErrorCode(
+ const android::base::Result<T>& result) {
if (result.ok()) {
- return ::aidl::android::hardware::automotive::vehicle::StatusCode::OK;
+ return aidl::android::hardware::automotive::vehicle::StatusCode::OK;
}
- return static_cast<::aidl::android::hardware::automotive::vehicle::StatusCode>(
+ return static_cast<aidl::android::hardware::automotive::vehicle::StatusCode>(
result.error().code());
}
template <class T>
-int getIntErrorCode(const ::android::base::Result<T>& result) {
+int getIntErrorCode(const android::base::Result<T>& result) {
return toInt(getErrorCode(result));
}
template <class T>
-std::string getErrorMsg(const ::android::base::Result<T>& result) {
+std::string getErrorMsg(const android::base::Result<T>& result) {
if (result.ok()) {
return "";
}
@@ -216,33 +214,32 @@
}
template <class T>
-::ndk::ScopedAStatus toScopedAStatus(
- const ::android::base::Result<T>& result,
- ::aidl::android::hardware::automotive::vehicle::StatusCode status,
- const std::string& additionalErrorMsg) {
+ndk::ScopedAStatus toScopedAStatus(const android::base::Result<T>& result,
+ aidl::android::hardware::automotive::vehicle::StatusCode status,
+ const std::string& additionalErrorMsg) {
if (result.ok()) {
- return ::ndk::ScopedAStatus::ok();
+ return ndk::ScopedAStatus::ok();
}
- return ::ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
toInt(status),
fmt::format("{}, error: {}", additionalErrorMsg, getErrorMsg(result)).c_str());
}
template <class T>
-::ndk::ScopedAStatus toScopedAStatus(
- const ::android::base::Result<T>& result,
- ::aidl::android::hardware::automotive::vehicle::StatusCode status) {
+ndk::ScopedAStatus toScopedAStatus(
+ const android::base::Result<T>& result,
+ aidl::android::hardware::automotive::vehicle::StatusCode status) {
return toScopedAStatus(result, status, "");
}
template <class T>
-::ndk::ScopedAStatus toScopedAStatus(const ::android::base::Result<T>& result) {
+ndk::ScopedAStatus toScopedAStatus(const android::base::Result<T>& result) {
return toScopedAStatus(result, getErrorCode(result));
}
template <class T>
-::ndk::ScopedAStatus toScopedAStatus(const ::android::base::Result<T>& result,
- const std::string& additionalErrorMsg) {
+ndk::ScopedAStatus toScopedAStatus(const android::base::Result<T>& result,
+ const std::string& additionalErrorMsg) {
return toScopedAStatus(result, getErrorCode(result), additionalErrorMsg);
}
@@ -255,9 +252,9 @@
// * If the type is FLOAT, {@code value.floatValues} must contain one element.
// * If the type is FLOAT_VEC, {@code value.floatValues} must contain at least one element.
// * If the type is MIXED, see checkVendorMixedPropValue.
-::android::base::Result<void> checkPropValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig* config);
+android::base::Result<void> checkPropValue(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig* config);
// Check whether the Mixed type value is valid according to config.
// We check for the following:
@@ -268,9 +265,9 @@
// * configArray[6] + configArray[7] must be equal to the number of {@code value.floatValues}
// elements.
// * configArray[8] must be equal to the number of {@code value.byteValues} elements.
-::android::base::Result<void> checkVendorMixedPropValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig* config);
+android::base::Result<void> checkVendorMixedPropValue(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
+ const aidl::android::hardware::automotive::vehicle::VehiclePropConfig* config);
// Check whether the value is within the configured range.
// We check for the following types:
@@ -282,9 +279,9 @@
// {@code minFloatValues} and {@code maxFloatValues} if either of them is not 0.
// We don't check other types. If more checks are required, they should be added in VehicleHardware
// implementation.
-::android::base::Result<void> checkValueRange(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
- const ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* config);
+android::base::Result<void> checkValueRange(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
+ const aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* config);
} // namespace vehicle
} // namespace automotive
diff --git a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
index bcb3c8d..5b41ff4 100644
--- a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
@@ -23,7 +23,7 @@
srcs: ["*.cpp"],
vendor: true,
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"libgtest",
"libgmock",
],
diff --git a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h
index f80d1e6..4213501 100644
--- a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h
+++ b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h
@@ -39,7 +39,7 @@
// 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(
- const ::aidl::android::hardware::automotive::vehicle::VehicleProperty& prop) {
+ const aidl::android::hardware::automotive::vehicle::VehicleProperty& prop) {
return (toInt(prop) & ~toInt(testpropertyutils_impl::VehiclePropertyGroup::MASK)) |
toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR);
}
diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp
index 295cbb7..49f48f7 100644
--- a/automotive/vehicle/aidl/impl/vhal/Android.bp
+++ b/automotive/vehicle/aidl/impl/vhal/Android.bp
@@ -33,7 +33,7 @@
static_libs: [
"DefaultVehicleHal",
"FakeVehicleHardware",
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
],
header_libs: [
"IVehicleHardware",
@@ -58,7 +58,7 @@
"src/SubscriptionManager.cpp",
],
static_libs: [
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
],
header_libs: [
"IVehicleHardware",
diff --git a/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h b/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h
index 15a6278..5d88f7c 100644
--- a/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h
+++ b/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h
@@ -43,7 +43,7 @@
class ConnectedClient {
public:
using CallbackType =
- std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>;
+ std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>;
ConnectedClient(std::shared_ptr<PendingRequestPool> requestPool, CallbackType callback);
@@ -57,7 +57,7 @@
// Returns {@code INVALID_ARG} error if any of the requestIds are duplicate with one of the
// pending request IDs or {@code TRY_AGAIN} error if the pending request pool is full and could
// no longer add requests.
- ::android::base::Result<void> addRequests(const std::unordered_set<int64_t>& requestIds);
+ android::base::Result<void> addRequests(const std::unordered_set<int64_t>& requestIds);
// Marks the requests as finished. Returns a list of request IDs that was pending and has been
// finished. It must be a set of the requested request IDs.
@@ -110,7 +110,7 @@
// callback.
static void sendUpdatedValues(
CallbackType callback,
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>&&
+ std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue>&&
updatedValues);
protected:
@@ -126,7 +126,7 @@
static void onGetValueResults(
const void* clientId, CallbackType callback,
std::shared_ptr<PendingRequestPool> requestPool,
- std::vector<::aidl::android::hardware::automotive::vehicle::GetValueResult> results);
+ std::vector<aidl::android::hardware::automotive::vehicle::GetValueResult> results);
};
} // namespace vehicle
diff --git a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
index 5e7adfc..9735ed3 100644
--- a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
+++ b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
@@ -39,39 +39,39 @@
namespace automotive {
namespace vehicle {
-class DefaultVehicleHal final : public ::aidl::android::hardware::automotive::vehicle::BnVehicle {
+class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehicle::BnVehicle {
public:
using CallbackType =
- std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>;
+ std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>;
explicit DefaultVehicleHal(std::unique_ptr<IVehicleHardware> hardware);
~DefaultVehicleHal();
- ::ndk::ScopedAStatus getAllPropConfigs(
- ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs)
+ ndk::ScopedAStatus getAllPropConfigs(
+ aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs)
override;
- ::ndk::ScopedAStatus getValues(
+ ndk::ScopedAStatus getValues(
const CallbackType& callback,
- const ::aidl::android::hardware::automotive::vehicle::GetValueRequests& requests)
+ const aidl::android::hardware::automotive::vehicle::GetValueRequests& requests)
override;
- ::ndk::ScopedAStatus setValues(
+ ndk::ScopedAStatus setValues(
const CallbackType& callback,
- const ::aidl::android::hardware::automotive::vehicle::SetValueRequests& requests)
+ const aidl::android::hardware::automotive::vehicle::SetValueRequests& requests)
override;
- ::ndk::ScopedAStatus getPropConfigs(
+ ndk::ScopedAStatus getPropConfigs(
const std::vector<int32_t>& props,
- ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs)
+ aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs)
override;
- ::ndk::ScopedAStatus subscribe(
+ ndk::ScopedAStatus subscribe(
const CallbackType& callback,
- const std::vector<::aidl::android::hardware::automotive::vehicle::SubscribeOptions>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::SubscribeOptions>&
options,
int32_t maxSharedMemoryFileCount) override;
- ::ndk::ScopedAStatus unsubscribe(const CallbackType& callback,
- const std::vector<int32_t>& propIds) override;
- ::ndk::ScopedAStatus returnSharedMemory(const CallbackType& callback,
- int64_t sharedMemoryId) override;
+ ndk::ScopedAStatus unsubscribe(const CallbackType& callback,
+ const std::vector<int32_t>& propIds) override;
+ ndk::ScopedAStatus returnSharedMemory(const CallbackType& callback,
+ int64_t sharedMemoryId) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
IVehicleHardware* getHardware();
@@ -81,11 +81,11 @@
friend class DefaultVehicleHalTest;
using GetValuesClient =
- GetSetValuesClient<::aidl::android::hardware::automotive::vehicle::GetValueResult,
- ::aidl::android::hardware::automotive::vehicle::GetValueResults>;
+ GetSetValuesClient<aidl::android::hardware::automotive::vehicle::GetValueResult,
+ aidl::android::hardware::automotive::vehicle::GetValueResults>;
using SetValuesClient =
- GetSetValuesClient<::aidl::android::hardware::automotive::vehicle::SetValueResult,
- ::aidl::android::hardware::automotive::vehicle::SetValueResults>;
+ GetSetValuesClient<aidl::android::hardware::automotive::vehicle::SetValueResult,
+ aidl::android::hardware::automotive::vehicle::SetValueResults>;
// A thread safe class to maintain an increasing request ID for each subscribe client. This
// class is safe to pass to async callbacks.
@@ -152,10 +152,10 @@
// mConfigsByPropId and mConfigFile are only modified during initialization, so no need to
// lock guard them.
- std::unordered_map<int32_t, ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig>
+ std::unordered_map<int32_t, aidl::android::hardware::automotive::vehicle::VehiclePropConfig>
mConfigsByPropId;
// Only modified in constructor, so thread-safe.
- std::unique_ptr<::ndk::ScopedFileDescriptor> mConfigFile;
+ std::unique_ptr<ndk::ScopedFileDescriptor> mConfigFile;
// PendingRequestPool is thread-safe.
std::shared_ptr<PendingRequestPool> mPendingRequestPool;
// SubscriptionManager is thread-safe.
@@ -176,31 +176,30 @@
// RecurrentTimer is thread-safe.
RecurrentTimer mRecurrentTimer;
- ::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
+ ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
- ::android::base::Result<void> checkProperty(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+ android::base::Result<void> checkProperty(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
- ::android::base::Result<std::vector<int64_t>> checkDuplicateRequests(
- const std::vector<::aidl::android::hardware::automotive::vehicle::GetValueRequest>&
+ android::base::Result<std::vector<int64_t>> checkDuplicateRequests(
+ const std::vector<aidl::android::hardware::automotive::vehicle::GetValueRequest>&
requests);
- ::android::base::Result<std::vector<int64_t>> checkDuplicateRequests(
- const std::vector<::aidl::android::hardware::automotive::vehicle::SetValueRequest>&
+ android::base::Result<std::vector<int64_t>> checkDuplicateRequests(
+ const std::vector<aidl::android::hardware::automotive::vehicle::SetValueRequest>&
requests);
- ::android::base::Result<void> checkSubscribeOptions(
- const std::vector<::aidl::android::hardware::automotive::vehicle::SubscribeOptions>&
+ android::base::Result<void> checkSubscribeOptions(
+ const std::vector<aidl::android::hardware::automotive::vehicle::SubscribeOptions>&
options);
- ::android::base::Result<void> checkReadPermission(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
+ android::base::Result<void> checkReadPermission(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
- ::android::base::Result<void> checkWritePermission(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
+ android::base::Result<void> checkWritePermission(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
- ::android::base::Result<
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig*>
+ android::base::Result<const aidl::android::hardware::automotive::vehicle::VehiclePropConfig*>
getConfig(int32_t propId) const;
void onBinderDiedWithContext(const AIBinder* clientId);
@@ -220,11 +219,11 @@
std::weak_ptr<IVehicleHardware> vehicleHardware,
std::shared_ptr<SubscribeIdByClient> subscribeIdByClient,
std::shared_ptr<SubscriptionClients> subscriptionClients, const CallbackType& callback,
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
static void onPropertyChangeEvent(
std::weak_ptr<SubscriptionManager> subscriptionManager,
- const std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue>&
updatedValues);
static void checkHealth(std::weak_ptr<IVehicleHardware> hardware,
diff --git a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h
index e739c8c..b0d6701 100644
--- a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h
+++ b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h
@@ -40,10 +40,10 @@
public:
using ClientIdType = const AIBinder*;
using CallbackType =
- std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback>;
+ std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>;
using GetValueFunc = std::function<void(
const CallbackType& callback,
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value)>;
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value)>;
explicit SubscriptionManager(GetValueFunc&& action);
~SubscriptionManager();
@@ -54,9 +54,9 @@
// Returns error if any of the subscribe options is not valid. If error is returned, no
// properties would be subscribed.
// Returns ok if all the options are parsed correctly and all the properties are subscribed.
- ::android::base::Result<void> subscribe(
+ android::base::Result<void> subscribe(
const CallbackType& callback,
- const std::vector<::aidl::android::hardware::automotive::vehicle::SubscribeOptions>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::SubscribeOptions>&
options,
bool isContinuousProperty);
@@ -64,23 +64,23 @@
// Returns error if the client was not subscribed before or one of the given property was not
// subscribed. If error is returned, no property would be unsubscribed.
// Returns ok if all the requested properties for the client are unsubscribed.
- ::android::base::Result<void> unsubscribe(ClientIdType client,
- const std::vector<int32_t>& propIds);
+ android::base::Result<void> unsubscribe(ClientIdType client,
+ const std::vector<int32_t>& propIds);
// Unsubscribes from all the properties for the client.
// Returns error if the client was not subscribed before. If error is returned, no property
// would be unsubscribed.
// Returns ok if all the properties for the client are unsubscribed.
- ::android::base::Result<void> unsubscribe(ClientIdType client);
+ android::base::Result<void> unsubscribe(ClientIdType client);
// For a list of updated properties, returns a map that maps clients subscribing to
// the updated properties to a list of updated values. This would only return on-change property
// clients that should be informed for the given updated values.
std::unordered_map<
CallbackType,
- std::vector<const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue*>>
+ std::vector<const aidl::android::hardware::automotive::vehicle::VehiclePropValue*>>
getSubscribedClients(
- const std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue>&
updatedValues);
// Checks whether the sample rate is valid.
@@ -145,7 +145,7 @@
std::shared_ptr<RecurrentTimer> mTimer;
const GetValueFunc mGetValue;
- static ::android::base::Result<int64_t> getInterval(float sampleRate);
+ static android::base::Result<int64_t> getInterval(float sampleRate);
// Checks whether the manager is empty. For testing purpose.
bool isEmpty();
diff --git a/automotive/vehicle/aidl/impl/vhal/test/Android.bp b/automotive/vehicle/aidl/impl/vhal/test/Android.bp
index d89f2c1..7122aa5 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/vhal/test/Android.bp
@@ -24,7 +24,7 @@
srcs: ["*.cpp"],
static_libs: [
"DefaultVehicleHal",
- "VehicleHalUtilsVendor",
+ "VehicleHalUtils",
"libgtest",
"libgmock",
],
diff --git a/automotive/vehicle/aidl/impl/vhal/test/ConnectedClientTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/ConnectedClientTest.cpp
index bdb0d31..682e9e6 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/ConnectedClientTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/ConnectedClientTest.cpp
@@ -34,7 +34,7 @@
using ::aidl::android::hardware::automotive::vehicle::StatusCode;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue;
-class ConnectedClientTest : public ::testing::Test {
+class ConnectedClientTest : public testing::Test {
public:
void SetUp() override {
mCallback = ndk::SharedRefBase::make<MockVehicleCallback>();
diff --git a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
index 7443d5b..178498b 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
@@ -216,7 +216,7 @@
} // namespace
-class DefaultVehicleHalTest : public ::testing::Test {
+class DefaultVehicleHalTest : public testing::Test {
public:
void SetUp() override {
auto hardware = std::make_unique<MockVehicleHardware>();
@@ -479,7 +479,7 @@
auto hardware = std::make_unique<MockVehicleHardware>();
hardware->setPropertyConfigs(testConfigs);
- auto vhal = ::ndk::SharedRefBase::make<DefaultVehicleHal>(std::move(hardware));
+ auto vhal = ndk::SharedRefBase::make<DefaultVehicleHal>(std::move(hardware));
std::shared_ptr<IVehicle> client = IVehicle::fromBinder(vhal->asBinder());
VehiclePropConfigs output;
@@ -500,7 +500,7 @@
auto hardware = std::make_unique<MockVehicleHardware>();
hardware->setPropertyConfigs(testConfigs);
- auto vhal = ::ndk::SharedRefBase::make<DefaultVehicleHal>(std::move(hardware));
+ auto vhal = ndk::SharedRefBase::make<DefaultVehicleHal>(std::move(hardware));
std::shared_ptr<IVehicle> client = IVehicle::fromBinder(vhal->asBinder());
VehiclePropConfigs output;
@@ -818,7 +818,7 @@
INSTANTIATE_TEST_SUITE_P(
SetValuesInvalidRequestTests, SetValuesInvalidRequestTest,
- ::testing::ValuesIn(getSetValuesInvalidRequestTestCases()),
+ testing::ValuesIn(getSetValuesInvalidRequestTestCases()),
[](const testing::TestParamInfo<SetValuesInvalidRequestTest::ParamType>& info) {
return info.param.name;
});
@@ -1427,7 +1427,7 @@
INSTANTIATE_TEST_SUITE_P(
SubscribeInvalidOptionsTests, SubscribeInvalidOptionsTest,
- ::testing::ValuesIn(getSubscribeInvalidOptionsTestCases()),
+ testing::ValuesIn(getSubscribeInvalidOptionsTestCases()),
[](const testing::TestParamInfo<SubscribeInvalidOptionsTest::ParamType>& info) {
return info.param.name;
});
diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h
index c83164f..03bfd5b 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h
+++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h
@@ -43,35 +43,33 @@
// MockVehicleCallback is a mock VehicleCallback implementation that simply stores the results.
class MockVehicleCallback final
- : public ::aidl::android::hardware::automotive::vehicle::BnVehicleCallback {
+ : public aidl::android::hardware::automotive::vehicle::BnVehicleCallback {
public:
- ::ndk::ScopedAStatus onGetValues(
- const ::aidl::android::hardware::automotive::vehicle::GetValueResults& results)
- override;
- ::ndk::ScopedAStatus onSetValues(
- const ::aidl::android::hardware::automotive::vehicle::SetValueResults& results)
- override;
- ::ndk::ScopedAStatus onPropertyEvent(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValues&,
+ ndk::ScopedAStatus onGetValues(
+ const aidl::android::hardware::automotive::vehicle::GetValueResults& results) override;
+ ndk::ScopedAStatus onSetValues(
+ const aidl::android::hardware::automotive::vehicle::SetValueResults& results) override;
+ ndk::ScopedAStatus onPropertyEvent(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValues&,
int32_t) override;
- ::ndk::ScopedAStatus onPropertySetError(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropErrors&) override;
+ ndk::ScopedAStatus onPropertySetError(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropErrors&) override;
// Test functions
- std::optional<::aidl::android::hardware::automotive::vehicle::GetValueResults>
+ std::optional<aidl::android::hardware::automotive::vehicle::GetValueResults>
nextGetValueResults();
- std::optional<::aidl::android::hardware::automotive::vehicle::SetValueResults>
+ std::optional<aidl::android::hardware::automotive::vehicle::SetValueResults>
nextSetValueResults();
- std::optional<::aidl::android::hardware::automotive::vehicle::VehiclePropValues>
+ std::optional<aidl::android::hardware::automotive::vehicle::VehiclePropValues>
nextOnPropertyEventResults();
private:
std::mutex mLock;
- std::list<::aidl::android::hardware::automotive::vehicle::GetValueResults> mGetValueResults
+ std::list<aidl::android::hardware::automotive::vehicle::GetValueResults> mGetValueResults
GUARDED_BY(mLock);
- std::list<::aidl::android::hardware::automotive::vehicle::SetValueResults> mSetValueResults
+ std::list<aidl::android::hardware::automotive::vehicle::SetValueResults> mSetValueResults
GUARDED_BY(mLock);
- std::list<::aidl::android::hardware::automotive::vehicle::VehiclePropValues>
+ std::list<aidl::android::hardware::automotive::vehicle::VehiclePropValues>
mOnPropertyEventResults GUARDED_BY(mLock);
int32_t mSharedMemoryFileCount GUARDED_BY(mLock);
};
diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h
index 74d4fae..cb8b6a0 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h
@@ -40,44 +40,44 @@
public:
~MockVehicleHardware();
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropConfig>
+ std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropConfig>
getAllPropertyConfigs() const override;
- ::aidl::android::hardware::automotive::vehicle::StatusCode setValues(
+ aidl::android::hardware::automotive::vehicle::StatusCode setValues(
std::shared_ptr<const SetValuesCallback> callback,
- const std::vector<::aidl::android::hardware::automotive::vehicle::SetValueRequest>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::SetValueRequest>&
requests) override;
- ::aidl::android::hardware::automotive::vehicle::StatusCode getValues(
+ aidl::android::hardware::automotive::vehicle::StatusCode getValues(
std::shared_ptr<const GetValuesCallback> callback,
- const std::vector<::aidl::android::hardware::automotive::vehicle::GetValueRequest>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::GetValueRequest>&
requests) const override;
DumpResult dump(const std::vector<std::string>&) override;
- ::aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() override;
+ aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() override;
void registerOnPropertyChangeEvent(
std::unique_ptr<const PropertyChangeCallback> callback) override;
void registerOnPropertySetErrorEvent(std::unique_ptr<const PropertySetErrorCallback>) override;
// Test functions.
void setPropertyConfigs(
- const std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropConfig>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropConfig>&
configs);
void addGetValueResponses(
- const std::vector<::aidl::android::hardware::automotive::vehicle::GetValueResult>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::GetValueResult>&
responses);
void addSetValueResponses(
- const std::vector<::aidl::android::hardware::automotive::vehicle::SetValueResult>&
+ const std::vector<aidl::android::hardware::automotive::vehicle::SetValueResult>&
responses);
void setGetValueResponder(
- std::function<::aidl::android::hardware::automotive::vehicle::StatusCode(
+ std::function<aidl::android::hardware::automotive::vehicle::StatusCode(
std::shared_ptr<const GetValuesCallback>,
const std::vector<
- ::aidl::android::hardware::automotive::vehicle::GetValueRequest>&)>&&
+ aidl::android::hardware::automotive::vehicle::GetValueRequest>&)>&&
responder);
- std::vector<::aidl::android::hardware::automotive::vehicle::GetValueRequest>
+ std::vector<aidl::android::hardware::automotive::vehicle::GetValueRequest>
nextGetValueRequests();
- std::vector<::aidl::android::hardware::automotive::vehicle::SetValueRequest>
+ std::vector<aidl::android::hardware::automotive::vehicle::SetValueRequest>
nextSetValueRequests();
void setStatus(const char* functionName,
- ::aidl::android::hardware::automotive::vehicle::StatusCode status);
+ aidl::android::hardware::automotive::vehicle::StatusCode status);
void setSleepTime(int64_t timeInNano);
void setDumpResult(DumpResult result);
@@ -85,31 +85,31 @@
mutable std::mutex mLock;
mutable std::condition_variable mCv;
mutable std::atomic<int> mThreadCount;
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropConfig> mPropertyConfigs
+ std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropConfig> mPropertyConfigs
GUARDED_BY(mLock);
- mutable std::list<std::vector<::aidl::android::hardware::automotive::vehicle::GetValueRequest>>
+ mutable std::list<std::vector<aidl::android::hardware::automotive::vehicle::GetValueRequest>>
mGetValueRequests GUARDED_BY(mLock);
- mutable std::list<std::vector<::aidl::android::hardware::automotive::vehicle::GetValueResult>>
+ mutable std::list<std::vector<aidl::android::hardware::automotive::vehicle::GetValueResult>>
mGetValueResponses GUARDED_BY(mLock);
- mutable std::list<std::vector<::aidl::android::hardware::automotive::vehicle::SetValueRequest>>
+ mutable std::list<std::vector<aidl::android::hardware::automotive::vehicle::SetValueRequest>>
mSetValueRequests GUARDED_BY(mLock);
- mutable std::list<std::vector<::aidl::android::hardware::automotive::vehicle::SetValueResult>>
+ mutable std::list<std::vector<aidl::android::hardware::automotive::vehicle::SetValueResult>>
mSetValueResponses GUARDED_BY(mLock);
- std::unordered_map<const char*, ::aidl::android::hardware::automotive::vehicle::StatusCode>
+ std::unordered_map<const char*, aidl::android::hardware::automotive::vehicle::StatusCode>
mStatusByFunctions GUARDED_BY(mLock);
int64_t mSleepTime GUARDED_BY(mLock) = 0;
std::unique_ptr<const PropertyChangeCallback> mPropertyChangeCallback GUARDED_BY(mLock);
- std::function<::aidl::android::hardware::automotive::vehicle::StatusCode(
+ std::function<aidl::android::hardware::automotive::vehicle::StatusCode(
std::shared_ptr<const GetValuesCallback>,
- const std::vector<::aidl::android::hardware::automotive::vehicle::GetValueRequest>&)>
+ const std::vector<aidl::android::hardware::automotive::vehicle::GetValueRequest>&)>
mGetValueResponder GUARDED_BY(mLock);
template <class ResultType>
- ::aidl::android::hardware::automotive::vehicle::StatusCode returnResponse(
+ aidl::android::hardware::automotive::vehicle::StatusCode returnResponse(
std::shared_ptr<const std::function<void(std::vector<ResultType>)>> callback,
std::list<std::vector<ResultType>>* storedResponses) const;
template <class RequestType, class ResultType>
- ::aidl::android::hardware::automotive::vehicle::StatusCode handleRequestsLocked(
+ aidl::android::hardware::automotive::vehicle::StatusCode handleRequestsLocked(
const char* functionName,
std::shared_ptr<const std::function<void(std::vector<ResultType>)>> callback,
const std::vector<RequestType>& requests,
diff --git a/automotive/vehicle/aidl/impl/vhal/test/RecurrentTimerTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/RecurrentTimerTest.cpp
index d343cea..a033a24 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/RecurrentTimerTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/RecurrentTimerTest.cpp
@@ -28,7 +28,7 @@
namespace automotive {
namespace vehicle {
-class RecurrentTimerTest : public ::testing::Test {
+class RecurrentTimerTest : public testing::Test {
public:
std::shared_ptr<RecurrentTimer::Callback> getCallback(size_t token) {
return std::make_shared<RecurrentTimer::Callback>([this, token] {
diff --git a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
index f81b1a2..2a468f6 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
@@ -83,7 +83,7 @@
std::list<VehiclePropValue> mEvents GUARDED_BY(mLock);
};
-class SubscriptionManagerTest : public ::testing::Test {
+class SubscriptionManagerTest : public testing::Test {
public:
void SetUp() override {
mManager = std::make_unique<SubscriptionManager>(
@@ -95,7 +95,7 @@
},
0);
});
- mCallback = ::ndk::SharedRefBase::make<PropertyCallback>();
+ mCallback = ndk::SharedRefBase::make<PropertyCallback>();
// Keep the local binder alive.
mBinder = mCallback->asBinder();
mCallbackClient = IVehicleCallback::fromBinder(mBinder);
@@ -350,9 +350,9 @@
},
};
- SpAIBinder binder1 = ::ndk::SharedRefBase::make<PropertyCallback>()->asBinder();
+ SpAIBinder binder1 = ndk::SharedRefBase::make<PropertyCallback>()->asBinder();
std::shared_ptr<IVehicleCallback> client1 = IVehicleCallback::fromBinder(binder1);
- SpAIBinder binder2 = ::ndk::SharedRefBase::make<PropertyCallback>()->asBinder();
+ SpAIBinder binder2 = ndk::SharedRefBase::make<PropertyCallback>()->asBinder();
std::shared_ptr<IVehicleCallback> client2 = IVehicleCallback::fromBinder(binder2);
auto result = getManager()->subscribe(client1, options1, false);
ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message();
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 3a6461e..9d1cb8f 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
@@ -36,6 +36,6 @@
parcelable OperationContext {
int id = 0;
android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN;
- boolean isAoD = false;
+ boolean isAod = false;
boolean isCrypto = false;
}
diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl
index 390e698..72fe660 100644
--- a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl
+++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl
@@ -41,8 +41,8 @@
*/
OperationReason reason = OperationReason.UNKNOWN;
- /* Flag indicating that the display is in AoD mode. */
- boolean isAoD = false;
+ /* Flag indicating that the display is in AOD mode. */
+ boolean isAod = false;
/** Flag indicating that crypto was requested. */
boolean isCrypto = false;
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 e383330..43db6cf 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
@@ -34,10 +34,13 @@
package android.hardware.biometrics.fingerprint;
@VintfStability
parcelable PointerContext {
- int pointerId = 0;
- int x = 0;
- int y = 0;
+ int pointerId = -1;
+ float x = 0.000000f;
+ float y = 0.000000f;
float minor = 0.000000f;
float major = 0.000000f;
- boolean isAoD = false;
+ float orientation = 0.000000f;
+ boolean isAod = false;
+ long time = 0;
+ long gestureStart = 0;
}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl
index 4975175..e025d34 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl
@@ -21,14 +21,35 @@
*/
@VintfStability
parcelable PointerContext {
- /* See android.view.MotionEvent#getPointerId. */
- int pointerId = 0;
+ /**
+ * Pointer ID obtained from MotionEvent#getPointerId or -1 if the ID cannot be obtained, for
+ * example if this event originated from a low-level wake-up gesture.
+ *
+ * See android.view.MotionEvent#getPointerId.
+ */
+ int pointerId = -1;
- /* The distance in pixels from the left edge of the display. */
- int x = 0;
+ /**
+ * The distance in pixels from the left edge of the display.
+ *
+ * This is obtained from MotionEvent#getRawX and translated relative to Surface#ROTATION_0.
+ * Meaning, this value is always reported as if the device is in its natural (e.g. portrait)
+ * orientation.
+ *
+ * See android.view.MotionEvent#getRawX.
+ */
+ float x = 0f;
- /* The distance in pixels from the top edge of the display. */
- int y = 0;
+ /**
+ * The distance in pixels from the top edge of the display.
+ *
+ * This is obtained from MotionEvent#getRawY and translated relative to Surface#ROTATION_0.
+ * Meaning, this value is always reported as if the device is in its natural (e.g. portrait)
+ * orientation.
+ *
+ * See android.view.MotionEvent#getRawY.
+ */
+ float y = 0f;
/* See android.view.MotionEvent#getTouchMinor. */
float minor = 0f;
@@ -36,6 +57,32 @@
/* See android.view.MotionEvent#getTouchMajor. */
float major = 0f;
- /* Flag indicating that the display is in AoD mode. */
- boolean isAoD = false;
+ /* See android.view.MotionEvent#getOrientation. */
+ float orientation = 0f;
+
+ /* Flag indicating that the display is in AOD mode. */
+ boolean isAod = false;
+
+ /**
+ * The time of the user interaction that produced this event, in milliseconds.
+ *
+ * This is obtained from MotionEvent#getEventTime, which uses SystemClock.uptimeMillis() as
+ * the clock.
+ *
+ * See android.view.MotionEvent#getEventTime
+ */
+ long time = 0;
+
+ /**
+ * The time of the first user interaction in this 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`.
+ *
+ * This is obtained from MotionEvent#getDownTime, which uses SystemClock.uptimeMillis() as
+ * the clock.
+ *
+ * See android.view.MotionEvent#getDownTime
+ */
+ long gestureStart = 0;
}
diff --git a/bluetooth/audio/2.2/OWNERS b/bluetooth/audio/2.2/OWNERS
new file mode 100644
index 0000000..84f5b1e
--- /dev/null
+++ b/bluetooth/audio/2.2/OWNERS
@@ -0,0 +1,3 @@
+aliceypkuo@google.com
+ugoyu@google.com
+sattiraju@google.com
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl
similarity index 76%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
copy to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl
index 5fa3926..4e5dfe6 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -33,12 +33,14 @@
package android.hardware.bluetooth.audio;
@VintfStability
-parcelable BroadcastConfiguration {
- android.hardware.bluetooth.audio.BroadcastConfiguration.BroadcastStreamMap[] streamMap;
- @VintfStability
- parcelable BroadcastStreamMap {
- char streamHandle;
- int audioChannelAllocation;
- android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
- }
+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/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl
similarity index 89%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl
index 766f637..0499b70 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -32,9 +32,11 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.audio;
-@Backing(type="byte") @VintfStability
-enum LeAudioMode {
- UNKNOWN = 0,
- UNICAST = 1,
- BROADCAST = 2,
+@Backing(type="int") @VintfStability
+enum AptxAdaptiveChannelMode {
+ JOINT_STEREO = 0,
+ MONO = 1,
+ DUAL_MONO = 2,
+ TWS_STEREO = 4,
+ UNKNOWN = 255,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl
similarity index 76%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
copy to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl
index 5fa3926..aab0521 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -33,12 +33,14 @@
package android.hardware.bluetooth.audio;
@VintfStability
-parcelable BroadcastConfiguration {
- android.hardware.bluetooth.audio.BroadcastConfiguration.BroadcastStreamMap[] streamMap;
- @VintfStability
- parcelable BroadcastStreamMap {
- char streamHandle;
- int audioChannelAllocation;
- android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
- }
+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/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl
similarity index 91%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl
index 766f637..f702939 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -32,9 +32,8 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.audio;
-@Backing(type="byte") @VintfStability
-enum LeAudioMode {
- UNKNOWN = 0,
- UNICAST = 1,
- BROADCAST = 2,
+@Backing(type="int") @VintfStability
+enum AptxAdaptiveInputMode {
+ STEREO = 0,
+ DUAL_MONO = 1,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl
similarity index 87%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl
index 766f637..3560666 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -32,9 +32,12 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.audio;
-@Backing(type="byte") @VintfStability
-enum LeAudioMode {
- UNKNOWN = 0,
- UNICAST = 1,
- BROADCAST = 2,
+@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/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxMode.aidl
similarity index 90%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxMode.aidl
index 766f637..d5dd9d9 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxMode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -32,9 +32,10 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.audio;
-@Backing(type="byte") @VintfStability
-enum LeAudioMode {
+@Backing(type="int") @VintfStability
+enum AptxMode {
UNKNOWN = 0,
- UNICAST = 1,
- BROADCAST = 2,
+ HIGH_QUALITY = 4096,
+ LOW_LATENCY = 8192,
+ ULTRA_LOW_LATENCY = 16384,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl
similarity index 88%
copy from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl
index 766f637..527418e 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -32,9 +32,12 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.audio;
-@Backing(type="byte") @VintfStability
-enum LeAudioMode {
- UNKNOWN = 0,
- UNICAST = 1,
- BROADCAST = 2,
+@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/current/android/hardware/bluetooth/audio/AudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AudioConfiguration.aidl
index 50b54c3..3abfb31 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/AudioConfiguration.aidl
@@ -37,4 +37,5 @@
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/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
index 7c0d825..c20c057 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
@@ -38,4 +38,5 @@
SUCCESS = 1,
UNSUPPORTED_CODEC_CONFIGURATION = 2,
FAILURE = 3,
+ RECONFIGURATION = 4,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecCapabilities.aidl
index 948c04a..6efdcb7 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecCapabilities.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecCapabilities.aidl
@@ -46,6 +46,7 @@
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;
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecConfiguration.aidl
index 32bccd8..77a6b1b 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecConfiguration.aidl
@@ -51,6 +51,7 @@
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;
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecType.aidl
index 3a5f951..1522cb4 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecType.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecType.aidl
@@ -42,4 +42,5 @@
LDAC = 5,
LC3 = 6,
VENDOR = 7,
+ APTX_ADAPTIVE = 8,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl
index 9a1557a..0033fee 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl
@@ -40,4 +40,5 @@
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/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
index 0dcba2e..6e0bd98 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
@@ -39,4 +39,5 @@
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/current/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
similarity index 92%
rename from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
rename to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
index 766f637..5583679 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -32,9 +32,9 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.audio;
-@Backing(type="byte") @VintfStability
-enum LeAudioMode {
+@Backing(type="int") @VintfStability
+enum LatencyMode {
UNKNOWN = 0,
- UNICAST = 1,
- BROADCAST = 2,
+ LOW_LATENCY = 1,
+ FREE = 2,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
similarity index 90%
rename from bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
rename to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
index 5fa3926..7d53b0c 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
@@ -33,8 +33,9 @@
package android.hardware.bluetooth.audio;
@VintfStability
-parcelable BroadcastConfiguration {
- android.hardware.bluetooth.audio.BroadcastConfiguration.BroadcastStreamMap[] streamMap;
+parcelable LeAudioBroadcastConfiguration {
+ android.hardware.bluetooth.audio.CodecType codecType;
+ android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap;
@VintfStability
parcelable BroadcastStreamMap {
char streamHandle;
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index 2bc1791..edb6795 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -34,12 +34,13 @@
package android.hardware.bluetooth.audio;
@VintfStability
parcelable LeAudioConfiguration {
- android.hardware.bluetooth.audio.LeAudioMode mode;
- android.hardware.bluetooth.audio.LeAudioConfiguration.LeAudioModeConfig modeConfig;
android.hardware.bluetooth.audio.CodecType codecType;
+ android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap;
+ int peerDelayUs;
+ android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
@VintfStability
- union LeAudioModeConfig {
- android.hardware.bluetooth.audio.UnicastConfiguration unicastConfig;
- android.hardware.bluetooth.audio.BroadcastConfiguration broadcastConfig;
+ parcelable StreamMap {
+ char streamHandle;
+ int audioChannelAllocation;
}
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl
index 72d7fb2..baec9c2 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl
@@ -42,4 +42,6 @@
LE_AUDIO_SOFTWARE_DECODING_DATAPATH = 5,
LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 6,
LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH = 7,
+ LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH = 8,
+ LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 9,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/UnicastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/UnicastConfiguration.aidl
deleted file mode 100644
index b385763..0000000
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/UnicastConfiguration.aidl
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible 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 UnicastConfiguration {
- android.hardware.bluetooth.audio.UnicastConfiguration.UnicastStreamMap[] streamMap;
- int peerDelay;
- android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
- @VintfStability
- parcelable UnicastStreamMap {
- char streamHandle;
- int audioChannelAllocation;
- }
-}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl
new file mode 100644
index 0000000..6a56704
--- /dev/null
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl
@@ -0,0 +1,37 @@
+/*
+ * 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.bluetooth.audio;
+
+import android.hardware.bluetooth.audio.AptxAdaptiveChannelMode;
+import android.hardware.bluetooth.audio.AptxMode;
+import android.hardware.bluetooth.audio.AptxSinkBuffering;
+import android.hardware.bluetooth.audio.AptxAdaptiveTimeToPlay;
+import android.hardware.bluetooth.audio.AptxAdaptiveInputMode;
+
+
+@VintfStability
+parcelable AptxAdaptiveCapabilities {
+ int[] sampleRateHz;
+ AptxAdaptiveChannelMode[] channelMode;
+ byte[] bitsPerSample;
+ AptxMode[] aptxMode;
+ AptxSinkBuffering sinkBufferingMs;
+ AptxAdaptiveTimeToPlay ttp;
+ AptxAdaptiveInputMode inputMode;
+ int inputFadeDurationMs;
+ byte[] aptxAdaptiveConfigStream;
+}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl
similarity index 62%
copy from bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl
index 2cf019e..c5e89b1 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -17,9 +17,15 @@
package android.hardware.bluetooth.audio;
@VintfStability
-@Backing(type="byte")
-enum LeAudioMode {
- UNKNOWN,
- UNICAST,
- BROADCAST,
+@Backing(type="int")
+enum AptxAdaptiveChannelMode {
+ /* Joint Stereo - default mode */
+ JOINT_STEREO = 0,
+ /* Legacy Mono */
+ MONO = 1,
+ /* Two streams L & R in a single channel (TWS) */
+ DUAL_MONO = 2,
+ /* Stereo - For TWS+ where L and R are different links */
+ TWS_STEREO = 4,
+ UNKNOWN = 0xFF,
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl
new file mode 100644
index 0000000..84c3119
--- /dev/null
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.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.bluetooth.audio;
+
+import android.hardware.bluetooth.audio.AptxAdaptiveChannelMode;
+import android.hardware.bluetooth.audio.AptxMode;
+import android.hardware.bluetooth.audio.AptxSinkBuffering;
+import android.hardware.bluetooth.audio.AptxAdaptiveTimeToPlay;
+import android.hardware.bluetooth.audio.AptxAdaptiveInputMode;
+
+@VintfStability
+parcelable AptxAdaptiveConfiguration {
+ int sampleRateHz;
+ AptxAdaptiveChannelMode channelMode;
+ byte bitsPerSample;
+ AptxMode aptxMode;
+ AptxSinkBuffering sinkBufferingMs;
+ AptxAdaptiveTimeToPlay ttp;
+ AptxAdaptiveInputMode inputMode;
+ int inputFadeDurationMs;
+ byte[] aptxAdaptiveConfigStream;
+}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl
similarity index 81%
copy from bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl
index 2cf019e..c2f0fc9 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -17,9 +17,8 @@
package android.hardware.bluetooth.audio;
@VintfStability
-@Backing(type="byte")
-enum LeAudioMode {
- UNKNOWN,
- UNICAST,
- BROADCAST,
+@Backing(type="int")
+enum AptxAdaptiveInputMode {
+ STEREO = 0x00,
+ DUAL_MONO = 0x01,
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl
similarity index 73%
copy from bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl
index 2cf019e..9bcf1a4 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -17,9 +17,11 @@
package android.hardware.bluetooth.audio;
@VintfStability
-@Backing(type="byte")
-enum LeAudioMode {
- UNKNOWN,
- UNICAST,
- BROADCAST,
+parcelable AptxAdaptiveTimeToPlay {
+ byte lowLowLatency;
+ byte highLowLatency;
+ byte lowHighQuality;
+ byte highHighQuality;
+ byte lowTws;
+ byte highTws;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxMode.aidl
similarity index 76%
copy from bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxMode.aidl
index 2cf019e..2422d69 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxMode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package android.hardware.bluetooth.audio;
-
@VintfStability
-@Backing(type="byte")
-enum LeAudioMode {
- UNKNOWN,
- UNICAST,
- BROADCAST,
+@Backing(type="int")
+enum AptxMode {
+ UNKNOWN = 0x00,
+ HIGH_QUALITY = 0x1000,
+ LOW_LATENCY = 0x2000,
+ ULTRA_LOW_LATENCY = 0x4000,
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl
similarity index 74%
copy from bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl
index 2cf019e..3593b5d 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -17,9 +17,12 @@
package android.hardware.bluetooth.audio;
@VintfStability
-@Backing(type="byte")
-enum LeAudioMode {
- UNKNOWN,
- UNICAST,
- BROADCAST,
+parcelable AptxSinkBuffering {
+ byte minLowLatency;
+ byte maxLowLatency;
+ byte minHighQuality;
+ byte maxHighQuality;
+ byte minTws;
+ byte maxTws;
}
+
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl
index 81b41dc..a06337e 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/AudioConfiguration.aidl
@@ -17,6 +17,7 @@
package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.CodecConfiguration;
+import android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration;
import android.hardware.bluetooth.audio.LeAudioConfiguration;
import android.hardware.bluetooth.audio.PcmConfiguration;
@@ -28,4 +29,5 @@
PcmConfiguration pcmConfig;
CodecConfiguration a2dpConfig;
LeAudioConfiguration leAudioConfig;
+ LeAudioBroadcastConfiguration leAudioBroadcastConfig;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
index ec78445..9ddafe9 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
@@ -23,5 +23,6 @@
SUCCESS = 1,
UNSUPPORTED_CODEC_CONFIGURATION = 2,
// General failure
- FAILURE = 3
+ FAILURE = 3,
+ RECONFIGURATION = 4,
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastCapability.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastCapability.aidl
index cb63f88..f1301fb 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastCapability.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastCapability.aidl
@@ -19,7 +19,6 @@
import android.hardware.bluetooth.audio.AudioLocation;
import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.Lc3Capabilities;
-import android.hardware.bluetooth.audio.LeAudioMode;
/**
* Used to specify the le audio broadcast codec capabilities for hardware offload.
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecCapabilities.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecCapabilities.aidl
index 41e2431..9fcdf1c 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecCapabilities.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecCapabilities.aidl
@@ -18,6 +18,7 @@
import android.hardware.bluetooth.audio.AacCapabilities;
import android.hardware.bluetooth.audio.AptxCapabilities;
+import android.hardware.bluetooth.audio.AptxAdaptiveCapabilities;
import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.Lc3Capabilities;
import android.hardware.bluetooth.audio.LdacCapabilities;
@@ -39,6 +40,7 @@
AacCapabilities aacCapabilities;
LdacCapabilities ldacCapabilities;
AptxCapabilities aptxCapabilities;
+ AptxAdaptiveCapabilities aptxAdaptiveCapabilities;
Lc3Capabilities lc3Capabilities;
VendorCapabilities vendorCapabilities;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecConfiguration.aidl
index 3679537..5ed12e3 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecConfiguration.aidl
@@ -18,6 +18,7 @@
import android.hardware.bluetooth.audio.AacConfiguration;
import android.hardware.bluetooth.audio.AptxConfiguration;
+import android.hardware.bluetooth.audio.AptxAdaptiveConfiguration;
import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.Lc3Configuration;
import android.hardware.bluetooth.audio.LdacConfiguration;
@@ -41,6 +42,7 @@
AacConfiguration aacConfig;
LdacConfiguration ldacConfig;
AptxConfiguration aptxConfig;
+ AptxAdaptiveConfiguration aptxAdaptiveConfig;
Lc3Configuration lc3Config;
VendorConfiguration vendorConfig;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecType.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecType.aidl
index 9c33081..386876e 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecType.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecType.aidl
@@ -27,4 +27,5 @@
LDAC,
LC3,
VENDOR,
+ APTX_ADAPTIVE,
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl
index 827f57d..9f8007b 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl
@@ -18,6 +18,8 @@
import android.hardware.audio.common.SinkMetadata;
import android.hardware.audio.common.SourceMetadata;
+import android.hardware.bluetooth.audio.CodecType;
+import android.hardware.bluetooth.audio.LatencyMode;
import android.hardware.bluetooth.audio.PresentationPosition;
/**
@@ -78,4 +80,11 @@
* @param sinkMetadata as passed from Audio Framework
*/
void updateSinkMetadata(in SinkMetadata sinkMetadata);
+
+ /**
+ * Called when latency mode is changed.
+ *
+ * @param latencyMode latency mode from audio
+ */
+ void setLatencyMode(in LatencyMode latencyMode);
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
index 6f88f30..ca6f691 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
@@ -82,4 +82,12 @@
* encoding.
*/
void updateAudioConfiguration(in AudioConfiguration audioConfig);
+
+ /**
+ * Called when the supported latency mode is updated.
+ *
+ * @param allowed If the peripheral devices can't keep up with low latency
+ * mode, the API will be called with supported is false.
+ */
+ void setLowLatencyModeAllowed(in boolean allowed);
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
similarity index 84%
rename from bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
rename to bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
index 2cf019e..0c354f7 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 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.
@@ -17,9 +17,9 @@
package android.hardware.bluetooth.audio;
@VintfStability
-@Backing(type="byte")
-enum LeAudioMode {
+@Backing(type="int")
+enum LatencyMode {
UNKNOWN,
- UNICAST,
- BROADCAST,
+ LOW_LATENCY,
+ FREE,
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
similarity index 87%
rename from bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
rename to bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
index cfc9d3a..e9a1a0c 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BroadcastConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
@@ -16,14 +16,15 @@
package android.hardware.bluetooth.audio;
+import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
@VintfStability
-parcelable BroadcastConfiguration {
+parcelable LeAudioBroadcastConfiguration {
@VintfStability
parcelable BroadcastStreamMap {
/*
- * The connection handle used for a unicast or a broadcast group.
+ * The connection handle used for a broadcast group.
* Range: 0x0000 to 0xEFFF
*/
char streamHandle;
@@ -35,5 +36,6 @@
int audioChannelAllocation;
LeAudioCodecConfiguration leAudioCodecConfig;
}
+ CodecType codecType;
BroadcastStreamMap[] streamMap;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index 515794b..0d1e3de 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -16,22 +16,28 @@
package android.hardware.bluetooth.audio;
-import android.hardware.bluetooth.audio.BroadcastConfiguration;
import android.hardware.bluetooth.audio.CodecType;
-import android.hardware.bluetooth.audio.LeAudioMode;
-import android.hardware.bluetooth.audio.UnicastConfiguration;
+import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
@VintfStability
parcelable LeAudioConfiguration {
@VintfStability
- union LeAudioModeConfig {
- UnicastConfiguration unicastConfig;
- BroadcastConfiguration broadcastConfig;
+ parcelable StreamMap {
+ /*
+ * The connection handle used for a unicast group.
+ * Range: 0x0000 to 0xEFFF
+ */
+ char streamHandle;
+ /*
+ * Audio channel allocation is a bit field, each enabled bit means that given audio
+ * direction, i.e. "left", or "right" is used. Ordering of audio channels comes from the
+ * least significant bit to the most significant bit. The valus follows the Bluetooth SIG
+ * Audio Location assigned number.
+ */
+ int audioChannelAllocation;
}
- /*
- * The mode of the LE audio
- */
- LeAudioMode mode;
- LeAudioModeConfig modeConfig;
CodecType codecType;
+ StreamMap[] streamMap;
+ int peerDelayUs;
+ LeAudioCodecConfiguration leAudioCodecConfig;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
index 30faae3..95beee7 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
@@ -33,19 +33,33 @@
*/
HEARING_AID_SOFTWARE_ENCODING_DATAPATH,
/**
- * Used when encoded by Bluetooth Stack and streaming to LE Audio device
+ * Used when audio is encoded by the Bluetooth Stack and is streamed to LE
+ * Audio unicast device.
*/
LE_AUDIO_SOFTWARE_ENCODING_DATAPATH,
/**
- * Used when decoded by Bluetooth Stack and streaming to audio framework
+ * Used when audio is decoded by the Bluetooth Stack and is streamed to LE
+ * Audio unicast device.
*/
LE_AUDIO_SOFTWARE_DECODING_DATAPATH,
/**
- * Encoding is done by HW an there is control only
+ * Used when audio is encoded by hardware offload and is streamed to LE
+ * Audio unicast device. This is a control path only.
*/
LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
/**
- * Decoding is done by HW an there is control only
+ * Used when audio is decoded by hardware offload and is streamed to LE
+ * Audio unicast device. This is a control path only.
*/
LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH,
+ /**
+ * Used when audio is encoded by the Bluetooth stack and is streamed to LE
+ * Audio broadcast channels.
+ */
+ LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH,
+ /**
+ * Used when audio is encoded by hardware offload and is streamed to LE
+ * Audio broadcast channels. This is a control path only.
+ */
+ LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastCapability.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastCapability.aidl
index cd8a4c1..f8a924a 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastCapability.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastCapability.aidl
@@ -19,7 +19,6 @@
import android.hardware.bluetooth.audio.AudioLocation;
import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.Lc3Capabilities;
-import android.hardware.bluetooth.audio.LeAudioMode;
/**
* Used to specify the le audio unicast codec capabilities for hardware offload.
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastConfiguration.aidl
deleted file mode 100644
index 7be2c5b..0000000
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/UnicastConfiguration.aidl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.bluetooth.audio;
-
-import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
-
-@VintfStability
-parcelable UnicastConfiguration {
- @VintfStability
- parcelable UnicastStreamMap {
- /*
- * The connection handle used for a unicast or a broadcast group.
- * Range: 0x0000 to 0xEFFF
- */
- char streamHandle;
- /*
- * Audio channel allocation is a bit field, each enabled bit means that given audio
- * direction, i.e. "left", or "right" is used. Ordering of audio channels comes from the
- * least significant bit to the most significant bit. The valus follows the Bluetooth SIG
- * Audio Location assigned number.
- */
- int audioChannelAllocation;
- }
- UnicastStreamMap[] streamMap;
- int peerDelay;
- LeAudioCodecConfiguration leAudioCodecConfig;
-}
diff --git a/bluetooth/audio/aidl/default/Android.bp b/bluetooth/audio/aidl/default/Android.bp
index fc882d4..13a5440 100644
--- a/bluetooth/audio/aidl/default/Android.bp
+++ b/bluetooth/audio/aidl/default/Android.bp
@@ -19,6 +19,7 @@
"HearingAidAudioProvider.cpp",
"LeAudioOffloadAudioProvider.cpp",
"LeAudioSoftwareAudioProvider.cpp",
+ "service.cpp",
],
export_include_dirs: ["."],
header_libs: ["libhardware_headers"],
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
index c2ffa2e..8090d26 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
@@ -121,6 +121,21 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus BluetoothAudioProvider::setLowLatencyModeAllowed(
+ bool allowed) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_);
+
+ if (stack_iface_ == nullptr) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
+ LOG(INFO) << __func__ << " - allowed " << allowed;
+ BluetoothAudioSessionReport::ReportLowLatencyModeAllowedChanged(
+ session_type_, allowed);
+ return ndk::ScopedAStatus::ok();
+}
+
void BluetoothAudioProvider::binderDiedCallbackAidl(void* ptr) {
LOG(ERROR) << __func__ << " - BluetoothAudio Service died";
auto provider = static_cast<BluetoothAudioProvider*>(ptr);
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
index f7acbdf..393aaba 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
@@ -46,6 +46,7 @@
ndk::ScopedAStatus streamSuspended(BluetoothAudioStatus status);
ndk::ScopedAStatus updateAudioConfiguration(
const AudioConfiguration& audio_config);
+ ndk::ScopedAStatus setLowLatencyModeAllowed(bool allowed);
virtual bool isValid(const SessionType& sessionType) = 0;
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
index 1e55a0b..1e1680a 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
@@ -64,6 +64,14 @@
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
provider = ndk::SharedRefBase::make<LeAudioOffloadInputAudioProvider>();
break;
+ case SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH:
+ provider =
+ ndk::SharedRefBase::make<LeAudioSoftwareBroadcastAudioProvider>();
+ break;
+ case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
+ provider =
+ ndk::SharedRefBase::make<LeAudioOffloadBroadcastAudioProvider>();
+ break;
default:
provider = nullptr;
break;
@@ -93,7 +101,10 @@
} else if (session_type ==
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
session_type ==
- SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
+ session_type ==
+ SessionType::
+ LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) {
std::vector<LeAudioCodecCapabilitiesSetting> db_codec_capabilities =
BluetoothAudioCodecs::GetLeAudioOffloadCodecCapabilities(session_type);
if (db_codec_capabilities.size()) {
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
index 72ac9bd..7a28513 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
@@ -38,6 +38,12 @@
session_type_ = SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH;
}
+LeAudioOffloadBroadcastAudioProvider::LeAudioOffloadBroadcastAudioProvider()
+ : LeAudioOffloadAudioProvider() {
+ session_type_ =
+ SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
+}
+
LeAudioOffloadAudioProvider::LeAudioOffloadAudioProvider()
: BluetoothAudioProvider() {}
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
index a27a2e7..6509a9e 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
@@ -48,6 +48,12 @@
LeAudioOffloadInputAudioProvider();
};
+class LeAudioOffloadBroadcastAudioProvider
+ : public LeAudioOffloadAudioProvider {
+ public:
+ LeAudioOffloadBroadcastAudioProvider();
+};
+
} // namespace audio
} // namespace bluetooth
} // namespace hardware
diff --git a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp
index 67b7d60..0fe205e 100644
--- a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp
@@ -55,6 +55,11 @@
session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH;
}
+LeAudioSoftwareBroadcastAudioProvider::LeAudioSoftwareBroadcastAudioProvider()
+ : LeAudioSoftwareAudioProvider() {
+ session_type_ = SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH;
+}
+
LeAudioSoftwareAudioProvider::LeAudioSoftwareAudioProvider()
: BluetoothAudioProvider(), data_mq_(nullptr) {}
@@ -78,7 +83,9 @@
}
uint32_t buffer_modifier = 0;
- if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH)
+ if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ ==
+ SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH)
buffer_modifier = kBufferOutCount;
else if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH)
buffer_modifier = kBufferInCount;
diff --git a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.h b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.h
index fa58182..ace4bff 100644
--- a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.h
+++ b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.h
@@ -51,6 +51,12 @@
LeAudioSoftwareInputAudioProvider();
};
+class LeAudioSoftwareBroadcastAudioProvider
+ : public LeAudioSoftwareAudioProvider {
+ public:
+ LeAudioSoftwareBroadcastAudioProvider();
+};
+
} // namespace audio
} // namespace bluetooth
} // namespace hardware
diff --git a/bluetooth/audio/aidl/default/service.cpp b/bluetooth/audio/aidl/default/service.cpp
new file mode 100644
index 0000000..f8f9cde
--- /dev/null
+++ b/bluetooth/audio/aidl/default/service.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.
+ */
+
+#define LOG_TAG "BtAudioAIDLService"
+
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <utils/Log.h>
+
+#include "BluetoothAudioProviderFactory.h"
+
+using ::aidl::android::hardware::bluetooth::audio::
+ BluetoothAudioProviderFactory;
+
+extern "C" __attribute__((visibility("default"))) binder_status_t
+createIBluetoothAudioProviderFactory() {
+ auto factory = ::ndk::SharedRefBase::make<BluetoothAudioProviderFactory>();
+ const std::string instance_name =
+ std::string() + BluetoothAudioProviderFactory::descriptor + "/default";
+ binder_status_t aidl_status = AServiceManager_addService(
+ factory->asBinder().get(), instance_name.c_str());
+ ALOGW_IF(aidl_status != STATUS_OK, "Could not register %s, status=%d",
+ instance_name.c_str(), aidl_status);
+ return aidl_status;
+}
\ No newline at end of file
diff --git a/bluetooth/audio/aidl/vts/Android.bp b/bluetooth/audio/aidl/vts/Android.bp
new file mode 100644
index 0000000..a662aaa
--- /dev/null
+++ b/bluetooth/audio/aidl/vts/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_test {
+ name: "VtsHalBluetoothAudioTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ srcs: ["VtsHalBluetoothAudioTargetTest.cpp"],
+ shared_libs: [
+ "android.hardware.audio.common-V1-ndk",
+ "android.hardware.bluetooth.audio-V1-ndk",
+ "android.hardware.common-V2-ndk",
+ "android.hardware.common.fmq-V1-ndk",
+ "libbase",
+ "libbinder_ndk",
+ "libcutils",
+ "libfmq",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
new file mode 100644
index 0000000..307403b
--- /dev/null
+++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
@@ -0,0 +1,1498 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/bluetooth/audio/BnBluetoothAudioPort.h>
+#include <aidl/android/hardware/bluetooth/audio/IBluetoothAudioPort.h>
+#include <aidl/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.h>
+#include <android/binder_auto_utils.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include <cstdint>
+#include <future>
+#include <unordered_set>
+#include <vector>
+
+using aidl::android::hardware::audio::common::SinkMetadata;
+using aidl::android::hardware::audio::common::SourceMetadata;
+using aidl::android::hardware::bluetooth::audio::AacCapabilities;
+using aidl::android::hardware::bluetooth::audio::AacConfiguration;
+using aidl::android::hardware::bluetooth::audio::AptxCapabilities;
+using aidl::android::hardware::bluetooth::audio::AptxConfiguration;
+using aidl::android::hardware::bluetooth::audio::AudioCapabilities;
+using aidl::android::hardware::bluetooth::audio::AudioConfiguration;
+using aidl::android::hardware::bluetooth::audio::BnBluetoothAudioPort;
+using aidl::android::hardware::bluetooth::audio::ChannelMode;
+using aidl::android::hardware::bluetooth::audio::CodecCapabilities;
+using aidl::android::hardware::bluetooth::audio::CodecConfiguration;
+using aidl::android::hardware::bluetooth::audio::CodecType;
+using aidl::android::hardware::bluetooth::audio::IBluetoothAudioPort;
+using aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider;
+using aidl::android::hardware::bluetooth::audio::IBluetoothAudioProviderFactory;
+using aidl::android::hardware::bluetooth::audio::LatencyMode;
+using aidl::android::hardware::bluetooth::audio::Lc3Capabilities;
+using aidl::android::hardware::bluetooth::audio::Lc3Configuration;
+using aidl::android::hardware::bluetooth::audio::LdacCapabilities;
+using aidl::android::hardware::bluetooth::audio::LdacConfiguration;
+using aidl::android::hardware::bluetooth::audio::
+ LeAudioCodecCapabilitiesSetting;
+using aidl::android::hardware::bluetooth::audio::LeAudioCodecConfiguration;
+using aidl::android::hardware::bluetooth::audio::LeAudioConfiguration;
+using aidl::android::hardware::bluetooth::audio::PcmConfiguration;
+using aidl::android::hardware::bluetooth::audio::PresentationPosition;
+using aidl::android::hardware::bluetooth::audio::SbcAllocMethod;
+using aidl::android::hardware::bluetooth::audio::SbcCapabilities;
+using aidl::android::hardware::bluetooth::audio::SbcChannelMode;
+using aidl::android::hardware::bluetooth::audio::SbcConfiguration;
+using aidl::android::hardware::bluetooth::audio::SessionType;
+using aidl::android::hardware::bluetooth::audio::UnicastCapability;
+using aidl::android::hardware::common::fmq::MQDescriptor;
+using aidl::android::hardware::common::fmq::SynchronizedReadWrite;
+using android::AidlMessageQueue;
+using android::ProcessState;
+using android::String16;
+using ndk::ScopedAStatus;
+using ndk::SpAIBinder;
+
+using MqDataType = int8_t;
+using MqDataMode = SynchronizedReadWrite;
+using DataMQ = AidlMessageQueue<MqDataType, MqDataMode>;
+using DataMQDesc = MQDescriptor<MqDataType, MqDataMode>;
+
+// Constants
+
+static constexpr int32_t a2dp_sample_rates[] = {0, 44100, 48000, 88200, 96000};
+static constexpr int8_t a2dp_bits_per_samples[] = {0, 16, 24, 32};
+static constexpr ChannelMode a2dp_channel_modes[] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+static constexpr CodecType a2dp_codec_types[] = {
+ CodecType::UNKNOWN, CodecType::SBC, CodecType::AAC,
+ CodecType::APTX, CodecType::APTX_HD, CodecType::LDAC,
+ CodecType::LC3, CodecType::APTX_ADAPTIVE};
+
+// Helpers
+
+template <typename T>
+struct identity {
+ typedef T type;
+};
+
+template <class T>
+bool contained_in_vector(const std::vector<T>& vector,
+ const typename identity<T>::type& target) {
+ return std::find(vector.begin(), vector.end(), target) != vector.end();
+}
+
+void copy_codec_specific(CodecConfiguration::CodecSpecific& dst,
+ const CodecConfiguration::CodecSpecific& src) {
+ switch (src.getTag()) {
+ case CodecConfiguration::CodecSpecific::sbcConfig:
+ dst.set<CodecConfiguration::CodecSpecific::sbcConfig>(
+ src.get<CodecConfiguration::CodecSpecific::sbcConfig>());
+ break;
+ case CodecConfiguration::CodecSpecific::aacConfig:
+ dst.set<CodecConfiguration::CodecSpecific::aacConfig>(
+ src.get<CodecConfiguration::CodecSpecific::aacConfig>());
+ break;
+ case CodecConfiguration::CodecSpecific::ldacConfig:
+ dst.set<CodecConfiguration::CodecSpecific::ldacConfig>(
+ src.get<CodecConfiguration::CodecSpecific::ldacConfig>());
+ break;
+ case CodecConfiguration::CodecSpecific::aptxConfig:
+ dst.set<CodecConfiguration::CodecSpecific::aptxConfig>(
+ src.get<CodecConfiguration::CodecSpecific::aptxConfig>());
+ break;
+ case CodecConfiguration::CodecSpecific::lc3Config:
+ dst.set<CodecConfiguration::CodecSpecific::lc3Config>(
+ src.get<CodecConfiguration::CodecSpecific::lc3Config>());
+ break;
+ case CodecConfiguration::CodecSpecific::aptxAdaptiveConfig:
+ dst.set<CodecConfiguration::CodecSpecific::aptxAdaptiveConfig>(
+ src.get<CodecConfiguration::CodecSpecific::aptxAdaptiveConfig>());
+ break;
+ default:
+ break;
+ }
+}
+
+class BluetoothAudioPort : public BnBluetoothAudioPort {
+ public:
+ BluetoothAudioPort() {}
+
+ ndk::ScopedAStatus startStream() { return ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus suspendStream() { return ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus stopStream() { return ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus getPresentationPosition(PresentationPosition*) {
+ return ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus updateSourceMetadata(const SourceMetadata&) {
+ return ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus updateSinkMetadata(const SinkMetadata&) {
+ return ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus setLatencyMode(const LatencyMode) {
+ return ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus setCodecType(const CodecType) {
+ return ScopedAStatus::ok();
+ }
+
+ protected:
+ virtual ~BluetoothAudioPort() = default;
+};
+
+class BluetoothAudioProviderFactoryAidl
+ : public testing::TestWithParam<std::string> {
+ public:
+ virtual void SetUp() override {
+ provider_factory_ = IBluetoothAudioProviderFactory::fromBinder(
+ SpAIBinder(AServiceManager_getService(GetParam().c_str())));
+ audio_provider_ = nullptr;
+ ASSERT_NE(provider_factory_, nullptr);
+ }
+
+ virtual void TearDown() override { provider_factory_ = nullptr; }
+
+ void GetProviderCapabilitiesHelper(const SessionType& session_type) {
+ temp_provider_capabilities_.clear();
+ auto aidl_retval = provider_factory_->getProviderCapabilities(
+ session_type, &temp_provider_capabilities_);
+ // AIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(aidl_retval.isOk());
+ switch (session_type) {
+ case SessionType::UNKNOWN: {
+ ASSERT_TRUE(temp_provider_capabilities_.empty());
+ } break;
+ case SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH:
+ case SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH:
+ case SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH:
+ case SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH:
+ case SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH: {
+ // All software paths are mandatory and must have exact 1
+ // "PcmParameters"
+ ASSERT_EQ(temp_provider_capabilities_.size(), 1);
+ ASSERT_EQ(temp_provider_capabilities_[0].getTag(),
+ AudioCapabilities::pcmCapabilities);
+ } break;
+ case SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH: {
+ std::unordered_set<CodecType> codec_types;
+ // empty capability means offload is unsupported
+ for (auto& audio_capability : temp_provider_capabilities_) {
+ ASSERT_EQ(audio_capability.getTag(),
+ AudioCapabilities::a2dpCapabilities);
+ const auto& codec_capabilities =
+ audio_capability.get<AudioCapabilities::a2dpCapabilities>();
+ // Every codec can present once at most
+ ASSERT_EQ(codec_types.count(codec_capabilities.codecType), 0);
+ switch (codec_capabilities.codecType) {
+ case CodecType::SBC:
+ ASSERT_EQ(codec_capabilities.capabilities.getTag(),
+ CodecCapabilities::Capabilities::sbcCapabilities);
+ break;
+ case CodecType::AAC:
+ ASSERT_EQ(codec_capabilities.capabilities.getTag(),
+ CodecCapabilities::Capabilities::aacCapabilities);
+ break;
+ case CodecType::APTX:
+ case CodecType::APTX_HD:
+ ASSERT_EQ(codec_capabilities.capabilities.getTag(),
+ CodecCapabilities::Capabilities::aptxCapabilities);
+ break;
+ case CodecType::LDAC:
+ ASSERT_EQ(codec_capabilities.capabilities.getTag(),
+ CodecCapabilities::Capabilities::ldacCapabilities);
+ break;
+ case CodecType::LC3:
+ ASSERT_EQ(codec_capabilities.capabilities.getTag(),
+ CodecCapabilities::Capabilities::lc3Capabilities);
+ break;
+ case CodecType::APTX_ADAPTIVE:
+ case CodecType::VENDOR:
+ case CodecType::UNKNOWN:
+ break;
+ }
+ codec_types.insert(codec_capabilities.codecType);
+ }
+ } break;
+ case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
+ case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
+ case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH: {
+ ASSERT_FALSE(temp_provider_capabilities_.empty());
+ for (auto audio_capability : temp_provider_capabilities_) {
+ ASSERT_EQ(audio_capability.getTag(),
+ AudioCapabilities::leAudioCapabilities);
+ }
+ } break;
+ }
+ }
+
+ /***
+ * This helps to open the specified provider and check the openProvider()
+ * has corruct return values. BUT, to keep it simple, it does not consider
+ * the capability, and please do so at the SetUp of each session's test.
+ ***/
+ void OpenProviderHelper(const SessionType& session_type) {
+ auto aidl_retval =
+ provider_factory_->openProvider(session_type, &audio_provider_);
+ if (aidl_retval.isOk()) {
+ ASSERT_NE(session_type, SessionType::UNKNOWN);
+ ASSERT_NE(audio_provider_, nullptr);
+ audio_port_ = ndk::SharedRefBase::make<BluetoothAudioPort>();
+ } else {
+ // Hardware offloading is optional
+ ASSERT_TRUE(
+ session_type == SessionType::UNKNOWN ||
+ session_type ==
+ SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
+ session_type ==
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
+ session_type ==
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
+ session_type ==
+ SessionType::
+ LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
+ ASSERT_EQ(audio_provider_, nullptr);
+ }
+ }
+
+ bool IsPcmConfigSupported(const PcmConfiguration& pcm_config) {
+ if (temp_provider_capabilities_.size() != 1 ||
+ temp_provider_capabilities_[0].getTag() !=
+ AudioCapabilities::pcmCapabilities) {
+ return false;
+ }
+ auto pcm_capability = temp_provider_capabilities_[0]
+ .get<AudioCapabilities::pcmCapabilities>();
+ return (contained_in_vector(pcm_capability.channelMode,
+ pcm_config.channelMode) &&
+ contained_in_vector(pcm_capability.sampleRateHz,
+ pcm_config.sampleRateHz) &&
+ contained_in_vector(pcm_capability.bitsPerSample,
+ pcm_config.bitsPerSample));
+ }
+
+ std::shared_ptr<IBluetoothAudioProviderFactory> provider_factory_;
+ std::shared_ptr<IBluetoothAudioProvider> audio_provider_;
+ std::shared_ptr<IBluetoothAudioPort> audio_port_;
+ std::vector<AudioCapabilities> temp_provider_capabilities_;
+
+ static constexpr SessionType kSessionTypes[] = {
+ SessionType::UNKNOWN,
+ SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH,
+ SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
+ SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH,
+ SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH,
+ SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH,
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH,
+ SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH,
+ SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
+ };
+};
+
+/**
+ * Test whether we can get the FactoryService from HIDL
+ */
+TEST_P(BluetoothAudioProviderFactoryAidl, GetProviderFactoryService) {}
+
+/**
+ * Test whether we can open a provider for each provider returned by
+ * getProviderCapabilities() with non-empty capabalities
+ */
+TEST_P(BluetoothAudioProviderFactoryAidl,
+ OpenProviderAndCheckCapabilitiesBySession) {
+ for (auto session_type : kSessionTypes) {
+ GetProviderCapabilitiesHelper(session_type);
+ OpenProviderHelper(session_type);
+ // We must be able to open a provider if its getProviderCapabilities()
+ // returns non-empty list.
+ EXPECT_TRUE(temp_provider_capabilities_.empty() ||
+ audio_provider_ != nullptr);
+ }
+}
+
+/**
+ * openProvider A2DP_SOFTWARE_ENCODING_DATAPATH
+ */
+class BluetoothAudioProviderA2dpSoftwareAidl
+ : public BluetoothAudioProviderFactoryAidl {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProviderFactoryAidl::SetUp();
+ GetProviderCapabilitiesHelper(SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH);
+ OpenProviderHelper(SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH);
+ ASSERT_NE(audio_provider_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProviderFactoryAidl::TearDown();
+ }
+};
+
+/**
+ * Test whether we can open a provider of type
+ */
+TEST_P(BluetoothAudioProviderA2dpSoftwareAidl, OpenA2dpSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH can be started and stopped with
+ * different PCM config
+ */
+TEST_P(BluetoothAudioProviderA2dpSoftwareAidl,
+ StartAndEndA2dpSoftwareSessionWithPossiblePcmConfig) {
+ for (auto sample_rate : a2dp_sample_rates) {
+ for (auto bits_per_sample : a2dp_bits_per_samples) {
+ for (auto channel_mode : a2dp_channel_modes) {
+ PcmConfiguration pcm_config{
+ .sampleRateHz = sample_rate,
+ .bitsPerSample = bits_per_sample,
+ .channelMode = channel_mode,
+ };
+ bool is_codec_config_valid = IsPcmConfigSupported(pcm_config);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(pcm_config), &mq_desc);
+ DataMQ data_mq(mq_desc);
+
+ EXPECT_EQ(aidl_retval.isOk(), is_codec_config_valid);
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(data_mq.isValid());
+ }
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+ }
+}
+
+/**
+ * openProvider A2DP_HARDWARE_OFFLOAD_DATAPATH
+ */
+class BluetoothAudioProviderA2dpHardwareAidl
+ : public BluetoothAudioProviderFactoryAidl {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProviderFactoryAidl::SetUp();
+ GetProviderCapabilitiesHelper(
+ SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
+ OpenProviderHelper(SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
+ ASSERT_TRUE(temp_provider_capabilities_.empty() ||
+ audio_provider_ != nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProviderFactoryAidl::TearDown();
+ }
+
+ bool IsOffloadSupported() { return (temp_provider_capabilities_.size() > 0); }
+
+ void GetA2dpOffloadCapabilityHelper(const CodecType& codec_type) {
+ temp_codec_capabilities_ = nullptr;
+ for (auto codec_capability : temp_provider_capabilities_) {
+ auto& a2dp_capabilities =
+ codec_capability.get<AudioCapabilities::a2dpCapabilities>();
+ if (a2dp_capabilities.codecType != codec_type) {
+ continue;
+ }
+ temp_codec_capabilities_ = &a2dp_capabilities;
+ }
+ }
+
+ std::vector<CodecConfiguration::CodecSpecific>
+ GetSbcCodecSpecificSupportedList(bool supported) {
+ std::vector<CodecConfiguration::CodecSpecific> sbc_codec_specifics;
+ if (!supported) {
+ SbcConfiguration sbc_config{.sampleRateHz = 0, .bitsPerSample = 0};
+ sbc_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(sbc_config));
+ return sbc_codec_specifics;
+ }
+ GetA2dpOffloadCapabilityHelper(CodecType::SBC);
+ if (temp_codec_capabilities_ == nullptr ||
+ temp_codec_capabilities_->codecType != CodecType::SBC) {
+ return sbc_codec_specifics;
+ }
+ // parse the capability
+ auto& sbc_capability =
+ temp_codec_capabilities_->capabilities
+ .get<CodecCapabilities::Capabilities::sbcCapabilities>();
+ if (sbc_capability.minBitpool > sbc_capability.maxBitpool) {
+ return sbc_codec_specifics;
+ }
+
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ for (int32_t sample_rate : sbc_capability.sampleRateHz) {
+ for (int8_t block_length : sbc_capability.blockLength) {
+ for (int8_t num_subbands : sbc_capability.numSubbands) {
+ for (int8_t bits_per_sample : sbc_capability.bitsPerSample) {
+ for (auto channel_mode : sbc_capability.channelMode) {
+ for (auto alloc_method : sbc_capability.allocMethod) {
+ SbcConfiguration sbc_data = {
+ .sampleRateHz = sample_rate,
+ .channelMode = channel_mode,
+ .blockLength = block_length,
+ .numSubbands = num_subbands,
+ .allocMethod = alloc_method,
+ .bitsPerSample = bits_per_sample,
+ .minBitpool = sbc_capability.minBitpool,
+ .maxBitpool = sbc_capability.maxBitpool};
+ sbc_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(sbc_data));
+ }
+ }
+ }
+ }
+ }
+ }
+ return sbc_codec_specifics;
+ }
+
+ std::vector<CodecConfiguration::CodecSpecific>
+ GetAacCodecSpecificSupportedList(bool supported) {
+ std::vector<CodecConfiguration::CodecSpecific> aac_codec_specifics;
+ if (!supported) {
+ AacConfiguration aac_config{.sampleRateHz = 0, .bitsPerSample = 0};
+ aac_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(aac_config));
+ return aac_codec_specifics;
+ }
+ GetA2dpOffloadCapabilityHelper(CodecType::AAC);
+ if (temp_codec_capabilities_ == nullptr ||
+ temp_codec_capabilities_->codecType != CodecType::AAC) {
+ return aac_codec_specifics;
+ }
+ // parse the capability
+ auto& aac_capability =
+ temp_codec_capabilities_->capabilities
+ .get<CodecCapabilities::Capabilities::aacCapabilities>();
+
+ std::vector<bool> variable_bit_rate_enableds = {false};
+ if (aac_capability.variableBitRateSupported) {
+ variable_bit_rate_enableds.push_back(true);
+ }
+
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ for (auto object_type : aac_capability.objectType) {
+ for (int32_t sample_rate : aac_capability.sampleRateHz) {
+ for (auto channel_mode : aac_capability.channelMode) {
+ for (int8_t bits_per_sample : aac_capability.bitsPerSample) {
+ for (auto variable_bit_rate_enabled : variable_bit_rate_enableds) {
+ AacConfiguration aac_data{
+ .objectType = object_type,
+ .sampleRateHz = sample_rate,
+ .channelMode = channel_mode,
+ .variableBitRateEnabled = variable_bit_rate_enabled,
+ .bitsPerSample = bits_per_sample};
+ aac_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(aac_data));
+ }
+ }
+ }
+ }
+ }
+ return aac_codec_specifics;
+ }
+
+ std::vector<CodecConfiguration::CodecSpecific>
+ GetLdacCodecSpecificSupportedList(bool supported) {
+ std::vector<CodecConfiguration::CodecSpecific> ldac_codec_specifics;
+ if (!supported) {
+ LdacConfiguration ldac_config{.sampleRateHz = 0, .bitsPerSample = 0};
+ ldac_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(ldac_config));
+ return ldac_codec_specifics;
+ }
+ GetA2dpOffloadCapabilityHelper(CodecType::LDAC);
+ if (temp_codec_capabilities_ == nullptr ||
+ temp_codec_capabilities_->codecType != CodecType::LDAC) {
+ return ldac_codec_specifics;
+ }
+ // parse the capability
+ auto& ldac_capability =
+ temp_codec_capabilities_->capabilities
+ .get<CodecCapabilities::Capabilities::ldacCapabilities>();
+
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ for (int32_t sample_rate : ldac_capability.sampleRateHz) {
+ for (int8_t bits_per_sample : ldac_capability.bitsPerSample) {
+ for (auto channel_mode : ldac_capability.channelMode) {
+ for (auto quality_index : ldac_capability.qualityIndex) {
+ LdacConfiguration ldac_data{.sampleRateHz = sample_rate,
+ .channelMode = channel_mode,
+ .qualityIndex = quality_index,
+ .bitsPerSample = bits_per_sample};
+ ldac_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(ldac_data));
+ }
+ }
+ }
+ }
+ return ldac_codec_specifics;
+ }
+
+ std::vector<CodecConfiguration::CodecSpecific>
+ GetAptxCodecSpecificSupportedList(bool is_hd, bool supported) {
+ std::vector<CodecConfiguration::CodecSpecific> aptx_codec_specifics;
+ if (!supported) {
+ AptxConfiguration aptx_config{.sampleRateHz = 0, .bitsPerSample = 0};
+ aptx_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(aptx_config));
+ return aptx_codec_specifics;
+ }
+ GetA2dpOffloadCapabilityHelper(
+ (is_hd ? CodecType::APTX_HD : CodecType::APTX));
+ if (temp_codec_capabilities_ == nullptr) {
+ return aptx_codec_specifics;
+ }
+ if ((is_hd && temp_codec_capabilities_->codecType != CodecType::APTX_HD) ||
+ (!is_hd && temp_codec_capabilities_->codecType != CodecType::APTX)) {
+ return aptx_codec_specifics;
+ }
+
+ // parse the capability
+ auto& aptx_capability =
+ temp_codec_capabilities_->capabilities
+ .get<CodecCapabilities::Capabilities::aptxCapabilities>();
+
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ for (int8_t bits_per_sample : aptx_capability.bitsPerSample) {
+ for (int32_t sample_rate : aptx_capability.sampleRateHz) {
+ for (auto channel_mode : aptx_capability.channelMode) {
+ AptxConfiguration aptx_data{.sampleRateHz = sample_rate,
+ .channelMode = channel_mode,
+ .bitsPerSample = bits_per_sample};
+ aptx_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(aptx_data));
+ }
+ }
+ }
+ return aptx_codec_specifics;
+ }
+
+ std::vector<CodecConfiguration::CodecSpecific>
+ GetLc3CodecSpecificSupportedList(bool supported) {
+ std::vector<CodecConfiguration::CodecSpecific> lc3_codec_specifics;
+ if (!supported) {
+ Lc3Configuration lc3_config{.samplingFrequencyHz = 0,
+ .frameDurationUs = 0};
+ lc3_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(lc3_config));
+ return lc3_codec_specifics;
+ }
+ GetA2dpOffloadCapabilityHelper(CodecType::LC3);
+ if (temp_codec_capabilities_ == nullptr ||
+ temp_codec_capabilities_->codecType != CodecType::LC3) {
+ return lc3_codec_specifics;
+ }
+ // parse the capability
+ auto& lc3_capability =
+ temp_codec_capabilities_->capabilities
+ .get<CodecCapabilities::Capabilities::lc3Capabilities>();
+
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ for (int32_t samplingFrequencyHz : lc3_capability.samplingFrequencyHz) {
+ for (int32_t frameDurationUs : lc3_capability.frameDurationUs) {
+ for (auto channel_mode : lc3_capability.channelMode) {
+ Lc3Configuration lc3_data{.samplingFrequencyHz = samplingFrequencyHz,
+ .channelMode = channel_mode,
+ .frameDurationUs = frameDurationUs};
+ lc3_codec_specifics.push_back(
+ CodecConfiguration::CodecSpecific(lc3_data));
+ }
+ }
+ }
+ return lc3_codec_specifics;
+ }
+
+ // temp storage saves the specified codec capability by
+ // GetOffloadCodecCapabilityHelper()
+ CodecCapabilities* temp_codec_capabilities_;
+};
+
+/**
+ * Test whether we can open a provider of type
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareAidl, OpenA2dpHardwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * SBC hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareAidl,
+ StartAndEndA2dpSbcHardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ CodecConfiguration codec_config = {
+ .codecType = CodecType::SBC,
+ .encodedAudioBitrate = 328000,
+ .peerMtu = 1005,
+ .isScmstEnabled = false,
+ };
+ auto sbc_codec_specifics = GetSbcCodecSpecificSupportedList(true);
+
+ for (auto& codec_specific : sbc_codec_specifics) {
+ copy_codec_specific(codec_config.config, codec_specific);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(codec_config), &mq_desc);
+
+ ASSERT_TRUE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * AAC hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareAidl,
+ StartAndEndA2dpAacHardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ CodecConfiguration codec_config = {
+ .codecType = CodecType::AAC,
+ .encodedAudioBitrate = 320000,
+ .peerMtu = 1005,
+ .isScmstEnabled = false,
+ };
+ auto aac_codec_specifics = GetAacCodecSpecificSupportedList(true);
+
+ for (auto& codec_specific : aac_codec_specifics) {
+ copy_codec_specific(codec_config.config, codec_specific);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(codec_config), &mq_desc);
+
+ ASSERT_TRUE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * LDAC hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareAidl,
+ StartAndEndA2dpLdacHardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ CodecConfiguration codec_config = {
+ .codecType = CodecType::LDAC,
+ .encodedAudioBitrate = 990000,
+ .peerMtu = 1005,
+ .isScmstEnabled = false,
+ };
+ auto ldac_codec_specifics = GetLdacCodecSpecificSupportedList(true);
+
+ for (auto& codec_specific : ldac_codec_specifics) {
+ copy_codec_specific(codec_config.config, codec_specific);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(codec_config), &mq_desc);
+
+ ASSERT_TRUE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * LDAC hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareAidl,
+ StartAndEndA2dpLc3HardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ CodecConfiguration codec_config = {
+ .codecType = CodecType::LC3,
+ .encodedAudioBitrate = 990000,
+ .peerMtu = 1005,
+ .isScmstEnabled = false,
+ };
+ auto lc3_codec_specifics = GetLc3CodecSpecificSupportedList(true);
+
+ for (auto& codec_specific : lc3_codec_specifics) {
+ copy_codec_specific(codec_config.config, codec_specific);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(codec_config), &mq_desc);
+
+ ASSERT_TRUE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * AptX hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareAidl,
+ StartAndEndA2dpAptxHardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ for (auto codec_type : {CodecType::APTX, CodecType::APTX_HD}) {
+ CodecConfiguration codec_config = {
+ .codecType = codec_type,
+ .encodedAudioBitrate =
+ (codec_type == CodecType::APTX ? 352000 : 576000),
+ .peerMtu = 1005,
+ .isScmstEnabled = false,
+ };
+
+ auto aptx_codec_specifics = GetAptxCodecSpecificSupportedList(
+ (codec_type == CodecType::APTX_HD ? true : false), true);
+
+ for (auto& codec_specific : aptx_codec_specifics) {
+ copy_codec_specific(codec_config.config, codec_specific);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(codec_config), &mq_desc);
+
+ ASSERT_TRUE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * an invalid codec config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareAidl,
+ StartAndEndA2dpHardwareSessionInvalidCodecConfig) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+ ASSERT_NE(audio_provider_, nullptr);
+
+ std::vector<CodecConfiguration::CodecSpecific> codec_specifics;
+ for (auto codec_type : a2dp_codec_types) {
+ switch (codec_type) {
+ case CodecType::SBC:
+ codec_specifics = GetSbcCodecSpecificSupportedList(false);
+ break;
+ case CodecType::AAC:
+ codec_specifics = GetAacCodecSpecificSupportedList(false);
+ break;
+ case CodecType::LDAC:
+ codec_specifics = GetLdacCodecSpecificSupportedList(false);
+ break;
+ case CodecType::APTX:
+ codec_specifics = GetAptxCodecSpecificSupportedList(false, false);
+ break;
+ case CodecType::APTX_HD:
+ codec_specifics = GetAptxCodecSpecificSupportedList(true, false);
+ break;
+ case CodecType::LC3:
+ codec_specifics = GetLc3CodecSpecificSupportedList(false);
+ continue;
+ case CodecType::APTX_ADAPTIVE:
+ case CodecType::VENDOR:
+ case CodecType::UNKNOWN:
+ codec_specifics.clear();
+ break;
+ }
+ if (codec_specifics.empty()) {
+ continue;
+ }
+
+ CodecConfiguration codec_config = {
+ .codecType = codec_type,
+ .encodedAudioBitrate = 328000,
+ .peerMtu = 1005,
+ .isScmstEnabled = false,
+ };
+ for (auto codec_specific : codec_specifics) {
+ copy_codec_specific(codec_config.config, codec_specific);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(codec_config), &mq_desc);
+
+ // AIDL call should fail on invalid codec
+ ASSERT_FALSE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+}
+
+/**
+ * openProvider HEARING_AID_SOFTWARE_ENCODING_DATAPATH
+ */
+class BluetoothAudioProviderHearingAidSoftwareAidl
+ : public BluetoothAudioProviderFactoryAidl {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProviderFactoryAidl::SetUp();
+ GetProviderCapabilitiesHelper(
+ SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH);
+ OpenProviderHelper(SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH);
+ ASSERT_NE(audio_provider_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProviderFactoryAidl::TearDown();
+ }
+
+ static constexpr int32_t hearing_aid_sample_rates_[] = {0, 16000, 24000};
+ static constexpr int8_t hearing_aid_bits_per_samples_[] = {0, 16, 24};
+ static constexpr ChannelMode hearing_aid_channel_modes_[] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+};
+
+/**
+ * Test whether we can open a provider of type
+ */
+TEST_P(BluetoothAudioProviderHearingAidSoftwareAidl,
+ OpenHearingAidSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH can be started and
+ * stopped with different PCM config
+ */
+TEST_P(BluetoothAudioProviderHearingAidSoftwareAidl,
+ StartAndEndHearingAidSessionWithPossiblePcmConfig) {
+ for (int32_t sample_rate : hearing_aid_sample_rates_) {
+ for (int8_t bits_per_sample : hearing_aid_bits_per_samples_) {
+ for (auto channel_mode : hearing_aid_channel_modes_) {
+ PcmConfiguration pcm_config{
+ .sampleRateHz = sample_rate,
+ .bitsPerSample = bits_per_sample,
+ .channelMode = channel_mode,
+ };
+ bool is_codec_config_valid = IsPcmConfigSupported(pcm_config);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(pcm_config), &mq_desc);
+ DataMQ data_mq(mq_desc);
+
+ EXPECT_EQ(aidl_retval.isOk(), is_codec_config_valid);
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(data_mq.isValid());
+ }
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+ }
+}
+
+/**
+ * openProvider LE_AUDIO_SOFTWARE_ENCODING_DATAPATH
+ */
+class BluetoothAudioProviderLeAudioOutputSoftwareAidl
+ : public BluetoothAudioProviderFactoryAidl {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProviderFactoryAidl::SetUp();
+ GetProviderCapabilitiesHelper(
+ SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH);
+ OpenProviderHelper(SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH);
+ ASSERT_NE(audio_provider_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProviderFactoryAidl::TearDown();
+ }
+
+ static constexpr int32_t le_audio_output_sample_rates_[] = {
+ 0, 8000, 16000, 24000, 32000, 44100, 48000,
+ };
+ static constexpr int8_t le_audio_output_bits_per_samples_[] = {0, 16, 24};
+ static constexpr ChannelMode le_audio_output_channel_modes_[] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+ static constexpr int32_t le_audio_output_data_interval_us_[] = {
+ 0 /* Invalid */, 10000 /* Valid 10ms */};
+};
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH can be started and
+ * stopped
+ */
+TEST_P(BluetoothAudioProviderLeAudioOutputSoftwareAidl,
+ OpenLeAudioOutputSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH can be started and
+ * stopped with different PCM config
+ */
+TEST_P(BluetoothAudioProviderLeAudioOutputSoftwareAidl,
+ StartAndEndLeAudioOutputSessionWithPossiblePcmConfig) {
+ for (auto sample_rate : le_audio_output_sample_rates_) {
+ for (auto bits_per_sample : le_audio_output_bits_per_samples_) {
+ for (auto channel_mode : le_audio_output_channel_modes_) {
+ for (auto data_interval_us : le_audio_output_data_interval_us_) {
+ PcmConfiguration pcm_config{
+ .sampleRateHz = sample_rate,
+ .bitsPerSample = bits_per_sample,
+ .channelMode = channel_mode,
+ .dataIntervalUs = data_interval_us,
+ };
+ bool is_codec_config_valid = IsPcmConfigSupported(pcm_config);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(pcm_config), &mq_desc);
+ DataMQ data_mq(mq_desc);
+
+ EXPECT_EQ(aidl_retval.isOk(), is_codec_config_valid);
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(data_mq.isValid());
+ }
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+ }
+ }
+}
+
+/**
+ * openProvider LE_AUDIO_SOFTWARE_DECODED_DATAPATH
+ */
+class BluetoothAudioProviderLeAudioInputSoftwareAidl
+ : public BluetoothAudioProviderFactoryAidl {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProviderFactoryAidl::SetUp();
+ GetProviderCapabilitiesHelper(
+ SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH);
+ OpenProviderHelper(SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH);
+ ASSERT_NE(audio_provider_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProviderFactoryAidl::TearDown();
+ }
+
+ static constexpr int32_t le_audio_input_sample_rates_[] = {
+ 0, 8000, 16000, 24000, 32000, 44100, 48000};
+ static constexpr int8_t le_audio_input_bits_per_samples_[] = {0, 16, 24};
+ static constexpr ChannelMode le_audio_input_channel_modes_[] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+ static constexpr int32_t le_audio_input_data_interval_us_[] = {
+ 0 /* Invalid */, 10000 /* Valid 10ms */};
+};
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH can be started and
+ * stopped
+ */
+TEST_P(BluetoothAudioProviderLeAudioInputSoftwareAidl,
+ OpenLeAudioInputSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH can be started and
+ * stopped with different PCM config
+ */
+TEST_P(BluetoothAudioProviderLeAudioInputSoftwareAidl,
+ StartAndEndLeAudioInputSessionWithPossiblePcmConfig) {
+ for (auto sample_rate : le_audio_input_sample_rates_) {
+ for (auto bits_per_sample : le_audio_input_bits_per_samples_) {
+ for (auto channel_mode : le_audio_input_channel_modes_) {
+ for (auto data_interval_us : le_audio_input_data_interval_us_) {
+ PcmConfiguration pcm_config{
+ .sampleRateHz = sample_rate,
+ .bitsPerSample = bits_per_sample,
+ .channelMode = channel_mode,
+ .dataIntervalUs = data_interval_us,
+ };
+ bool is_codec_config_valid = IsPcmConfigSupported(pcm_config);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(pcm_config), &mq_desc);
+ DataMQ data_mq(mq_desc);
+
+ EXPECT_EQ(aidl_retval.isOk(), is_codec_config_valid);
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(data_mq.isValid());
+ }
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+ }
+ }
+}
+
+/**
+ * openProvider LE_AUDIO_HARDWARE_OFFLOAD_DECODED_DATAPATH
+ */
+class BluetoothAudioProviderLeAudioOutputHardwareAidl
+ : public BluetoothAudioProviderFactoryAidl {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProviderFactoryAidl::SetUp();
+ GetProviderCapabilitiesHelper(
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
+ OpenProviderHelper(
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
+ ASSERT_TRUE(temp_provider_capabilities_.empty() ||
+ audio_provider_ != nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProviderFactoryAidl::TearDown();
+ }
+
+ bool IsOffloadOutputSupported() {
+ for (auto& capability : temp_provider_capabilities_) {
+ if (capability.getTag() != AudioCapabilities::leAudioCapabilities) {
+ continue;
+ }
+ auto& le_audio_capability =
+ capability.get<AudioCapabilities::leAudioCapabilities>();
+ if (le_audio_capability.unicastEncodeCapability.codecType !=
+ CodecType::UNKNOWN)
+ return true;
+ }
+ return false;
+ }
+
+ std::vector<Lc3Configuration> GetUnicastLc3SupportedList(bool decoding,
+ bool supported) {
+ std::vector<Lc3Configuration> le_audio_codec_configs;
+ if (!supported) {
+ Lc3Configuration lc3_config{.samplingFrequencyHz = 0, .pcmBitDepth = 0};
+ le_audio_codec_configs.push_back(lc3_config);
+ return le_audio_codec_configs;
+ }
+
+ // There might be more than one LeAudioCodecCapabilitiesSetting
+ std::vector<Lc3Capabilities> lc3_capabilities;
+ for (auto& capability : temp_provider_capabilities_) {
+ if (capability.getTag() != AudioCapabilities::leAudioCapabilities) {
+ continue;
+ }
+ auto& le_audio_capability =
+ capability.get<AudioCapabilities::leAudioCapabilities>();
+ auto& unicast_capability =
+ decoding ? le_audio_capability.unicastDecodeCapability
+ : le_audio_capability.unicastEncodeCapability;
+ if (unicast_capability.codecType != CodecType::LC3) {
+ continue;
+ }
+ auto& lc3_capability = unicast_capability.leAudioCodecCapabilities.get<
+ UnicastCapability::LeAudioCodecCapabilities::lc3Capabilities>();
+ lc3_capabilities.push_back(lc3_capability);
+ }
+
+ // Combine those parameters into one list of LeAudioCodecConfiguration
+ // This seems horrible, but usually each Lc3Capability only contains a
+ // single Lc3Configuration, which means every array has a length of 1.
+ for (auto& lc3_capability : lc3_capabilities) {
+ for (int32_t samplingFrequencyHz : lc3_capability.samplingFrequencyHz) {
+ for (int32_t frameDurationUs : lc3_capability.frameDurationUs) {
+ for (int32_t octetsPerFrame : lc3_capability.octetsPerFrame) {
+ Lc3Configuration lc3_config = {
+ .samplingFrequencyHz = samplingFrequencyHz,
+ .frameDurationUs = frameDurationUs,
+ .octetsPerFrame = octetsPerFrame,
+ };
+ le_audio_codec_configs.push_back(lc3_config);
+ }
+ }
+ }
+ }
+
+ return le_audio_codec_configs;
+ }
+
+ LeAudioCodecCapabilitiesSetting temp_le_audio_capabilities_;
+};
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH can be started and
+ * stopped
+ */
+TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl,
+ OpenLeAudioOutputHardwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH can be started and
+ * stopped with Unicast hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl,
+ StartAndEndLeAudioOutputSessionWithPossibleUnicastConfig) {
+ if (!IsOffloadOutputSupported()) {
+ return;
+ }
+
+ auto lc3_codec_configs =
+ GetUnicastLc3SupportedList(false /* decoding */, true /* supported */);
+ LeAudioConfiguration le_audio_config = {
+ .codecType = CodecType::LC3,
+ .peerDelayUs = 0,
+ };
+
+ for (auto& lc3_config : lc3_codec_configs) {
+ le_audio_config.leAudioCodecConfig
+ .set<LeAudioCodecConfiguration::lc3Config>(lc3_config);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(le_audio_config), &mq_desc);
+
+ ASSERT_TRUE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH can be started and
+ * stopped with Unicast hardware encoding config
+ *
+ * Disabled since offload codec checking is not ready
+ */
+TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl,
+ DISABLED_StartAndEndLeAudioOutputSessionWithInvalidAudioConfiguration) {
+ if (!IsOffloadOutputSupported()) {
+ return;
+ }
+
+ auto lc3_codec_configs =
+ GetUnicastLc3SupportedList(false /* decoding */, false /* supported */);
+ LeAudioConfiguration le_audio_config = {
+ .codecType = CodecType::LC3,
+ .peerDelayUs = 0,
+ };
+
+ for (auto& lc3_config : lc3_codec_configs) {
+ le_audio_config.leAudioCodecConfig
+ .set<LeAudioCodecConfiguration::lc3Config>(lc3_config);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(le_audio_config), &mq_desc);
+
+ // AIDL call should fail on invalid codec
+ ASSERT_FALSE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * openProvider LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH
+ */
+class BluetoothAudioProviderLeAudioInputHardwareAidl
+ : public BluetoothAudioProviderLeAudioOutputHardwareAidl {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProviderFactoryAidl::SetUp();
+ GetProviderCapabilitiesHelper(
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH);
+ OpenProviderHelper(
+ SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH);
+ ASSERT_TRUE(temp_provider_capabilities_.empty() ||
+ audio_provider_ != nullptr);
+ }
+
+ bool IsOffloadInputSupported() {
+ for (auto& capability : temp_provider_capabilities_) {
+ if (capability.getTag() != AudioCapabilities::leAudioCapabilities) {
+ continue;
+ }
+ auto& le_audio_capability =
+ capability.get<AudioCapabilities::leAudioCapabilities>();
+ if (le_audio_capability.unicastDecodeCapability.codecType !=
+ CodecType::UNKNOWN)
+ return true;
+ }
+ return false;
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProviderFactoryAidl::TearDown();
+ }
+};
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH can be started and
+ * stopped
+ */
+TEST_P(BluetoothAudioProviderLeAudioInputHardwareAidl,
+ OpenLeAudioInputHardwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH can be started and
+ * stopped with Unicast hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderLeAudioInputHardwareAidl,
+ StartAndEndLeAudioInputSessionWithPossibleUnicastConfig) {
+ if (!IsOffloadInputSupported()) {
+ return;
+ }
+
+ auto lc3_codec_configs =
+ GetUnicastLc3SupportedList(true /* decoding */, true /* supported */);
+ LeAudioConfiguration le_audio_config = {
+ .codecType = CodecType::LC3,
+ .peerDelayUs = 0,
+ };
+
+ for (auto& lc3_config : lc3_codec_configs) {
+ le_audio_config.leAudioCodecConfig
+ .set<LeAudioCodecConfiguration::lc3Config>(lc3_config);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(le_audio_config), &mq_desc);
+
+ ASSERT_TRUE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH can be started and
+ * stopped with Unicast hardware encoding config
+ *
+ * Disabled since offload codec checking is not ready
+ */
+TEST_P(BluetoothAudioProviderLeAudioInputHardwareAidl,
+ DISABLED_StartAndEndLeAudioInputSessionWithInvalidAudioConfiguration) {
+ if (!IsOffloadInputSupported()) {
+ return;
+ }
+
+ auto lc3_codec_configs =
+ GetUnicastLc3SupportedList(true /* decoding */, false /* supported */);
+ LeAudioConfiguration le_audio_config = {
+ .codecType = CodecType::LC3,
+ .peerDelayUs = 0,
+ };
+
+ for (auto& lc3_config : lc3_codec_configs) {
+ le_audio_config.leAudioCodecConfig
+ .set<LeAudioCodecConfiguration::lc3Config>(lc3_config);
+
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(le_audio_config), &mq_desc);
+
+ // AIDL call should fail on invalid codec
+ ASSERT_FALSE(aidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * openProvider LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH
+ */
+class BluetoothAudioProviderLeAudioBroadcastSoftwareAidl
+ : public BluetoothAudioProviderFactoryAidl {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProviderFactoryAidl::SetUp();
+ GetProviderCapabilitiesHelper(
+ SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH);
+ OpenProviderHelper(
+ SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH);
+ ASSERT_NE(audio_provider_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProviderFactoryAidl::TearDown();
+ }
+
+ static constexpr int32_t le_audio_output_sample_rates_[] = {
+ 0, 8000, 16000, 24000, 32000, 44100, 48000,
+ };
+ static constexpr int8_t le_audio_output_bits_per_samples_[] = {0, 16, 24};
+ static constexpr ChannelMode le_audio_output_channel_modes_[] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+ static constexpr int32_t le_audio_output_data_interval_us_[] = {
+ 0 /* Invalid */, 10000 /* Valid 10ms */};
+};
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH can be started and
+ * stopped
+ */
+TEST_P(BluetoothAudioProviderLeAudioBroadcastSoftwareAidl,
+ DISABLED_OpenLeAudioOutputSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH can be started and
+ * stopped with different PCM config
+ */
+TEST_P(BluetoothAudioProviderLeAudioBroadcastSoftwareAidl,
+ DISABLED_StartAndEndLeAudioOutputSessionWithPossiblePcmConfig) {
+ for (auto sample_rate : le_audio_output_sample_rates_) {
+ for (auto bits_per_sample : le_audio_output_bits_per_samples_) {
+ for (auto channel_mode : le_audio_output_channel_modes_) {
+ for (auto data_interval_us : le_audio_output_data_interval_us_) {
+ PcmConfiguration pcm_config{
+ .sampleRateHz = sample_rate,
+ .bitsPerSample = bits_per_sample,
+ .channelMode = channel_mode,
+ .dataIntervalUs = data_interval_us,
+ };
+ bool is_codec_config_valid = IsPcmConfigSupported(pcm_config);
+ DataMQDesc mq_desc;
+ auto aidl_retval = audio_provider_->startSession(
+ audio_port_, AudioConfiguration(pcm_config), &mq_desc);
+ DataMQ data_mq(mq_desc);
+
+ EXPECT_EQ(aidl_retval.isOk(), is_codec_config_valid);
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(data_mq.isValid());
+ }
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+ }
+ }
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderFactoryAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance, BluetoothAudioProviderFactoryAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderA2dpSoftwareAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance, BluetoothAudioProviderA2dpSoftwareAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderA2dpHardwareAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance, BluetoothAudioProviderA2dpHardwareAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderHearingAidSoftwareAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderHearingAidSoftwareAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderLeAudioOutputSoftwareAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderLeAudioOutputSoftwareAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderLeAudioInputSoftwareAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderLeAudioInputSoftwareAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderLeAudioOutputHardwareAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderLeAudioOutputHardwareAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderLeAudioInputHardwareAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderLeAudioInputHardwareAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderLeAudioBroadcastSoftwareAidl);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderLeAudioBroadcastSoftwareAidl,
+ testing::ValuesIn(android::getAidlHalInstanceNames(
+ IBluetoothAudioProviderFactory::descriptor)),
+ android::PrintInstanceNameToString);
+
+// TODO(219668925): Add LE Audio Broadcast VTS
+// GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+// BluetoothAudioProviderLeAudioBroadcastHardwareAidl);
+// INSTANTIATE_TEST_SUITE_P(PerInstance,
+// BluetoothAudioProviderLeAudioBroadcastHardwareAidl,
+// testing::ValuesIn(android::getAidlHalInstanceNames(
+// IBluetoothAudioProviderFactory::descriptor)),
+// android::PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
index 516ebe8..a6fd798 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
@@ -132,9 +132,13 @@
// Stores the supported setting of audio location, connected device, and the
// channel count for each device
std::vector<std::tuple<AudioLocation, uint8_t, uint8_t>>
- supportedDeviceSetting = {std::make_tuple(stereoAudio, 2, 1),
- std::make_tuple(monoAudio, 1, 2),
- std::make_tuple(monoAudio, 1, 1)};
+ supportedDeviceSetting = {
+ // Stereo, two connected device, one for L one for R
+ std::make_tuple(stereoAudio, 2, 1),
+ // Stereo, one connected device for both L and R
+ std::make_tuple(stereoAudio, 1, 2),
+ // Mono
+ std::make_tuple(monoAudio, 1, 1)};
template <class T>
bool BluetoothAudioCodecs::ContainedInVector(
@@ -356,6 +360,7 @@
break;
case CodecType::UNKNOWN:
case CodecType::VENDOR:
+ case CodecType::APTX_ADAPTIVE:
break;
}
}
@@ -419,6 +424,7 @@
return true;
}
break;
+ case CodecType::APTX_ADAPTIVE:
case CodecType::UNKNOWN:
case CodecType::VENDOR:
break;
@@ -487,4 +493,4 @@
} // namespace bluetooth
} // namespace hardware
} // namespace android
-} // namespace aidl
\ No newline at end of file
+} // namespace aidl
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
index f626db8..7187828 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
@@ -94,6 +94,8 @@
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
return AudioConfiguration(LeAudioConfiguration{});
+ case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
+ return AudioConfiguration(LeAudioBroadcastConfiguration{});
default:
return AudioConfiguration(PcmConfiguration{});
}
@@ -137,6 +139,8 @@
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
session_type_ ==
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
+ session_type_ ==
+ SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
(data_mq_ != nullptr && data_mq_->isValid()));
return stack_iface_ != nullptr && is_mq_valid && audio_config_ != nullptr;
}
@@ -259,7 +263,9 @@
(session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
session_type_ == SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH ||
session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH ||
- session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH);
+ session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ ==
+ SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH);
bool is_offload_a2dp_session =
(session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
bool is_offload_le_audio_session =
@@ -410,6 +416,22 @@
}
}
+void BluetoothAudioSession::ReportLowLatencyModeAllowedChanged(bool allowed) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (observers_.empty()) {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO port state observer";
+ return;
+ }
+ for (auto& observer : observers_) {
+ uint16_t cookie = observer.first;
+ std::shared_ptr<PortStatusCallbacks> callback = observer.second;
+ LOG(INFO) << __func__
+ << " - allowed=" << (allowed ? " allowed" : " disallowed");
+ callback->low_latency_mode_allowed_cb_(cookie, allowed);
+ }
+}
+
bool BluetoothAudioSession::GetPresentationPosition(
PresentationPosition& presentation_position) {
std::lock_guard<std::recursive_mutex> guard(mutex_);
@@ -508,6 +530,21 @@
}
}
+void BluetoothAudioSession::SetLatencyMode(LatencyMode latency_mode) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (!IsSessionReady()) {
+ LOG(DEBUG) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ return;
+ }
+
+ auto hal_retval = stack_iface_->setLatencyMode(latency_mode);
+ if (!hal_retval.isOk()) {
+ LOG(WARNING) << __func__ << " - IBluetoothAudioPort SessionType="
+ << toString(session_type_) << " failed";
+ }
+}
+
bool BluetoothAudioSession::IsAidlAvailable() {
if (is_aidl_checked) return is_aidl_available;
is_aidl_available =
@@ -547,4 +584,4 @@
} // namespace bluetooth
} // namespace hardware
} // namespace android
-} // namespace aidl
\ No newline at end of file
+} // namespace aidl
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
index 73bc0f8..6e390cc 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
@@ -20,6 +20,7 @@
#include <aidl/android/hardware/audio/common/SourceMetadata.h>
#include <aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.h>
#include <aidl/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.h>
+#include <aidl/android/hardware/bluetooth/audio/LatencyMode.h>
#include <aidl/android/hardware/bluetooth/audio/SessionType.h>
#include <fmq/AidlMessageQueue.h>
#include <hardware/audio.h>
@@ -91,6 +92,15 @@
* @param: cookie - indicates which bluetooth_audio output should handle
***/
std::function<void(uint16_t cookie)> audio_configuration_changed_cb_;
+ /***
+ * low_latency_mode_allowed_cb_ - when the Bluetooth stack low latency mode
+ * allowed or disallowed, the BluetoothAudioProvider will invoke
+ * this callback to report to the bluetooth_audio module.
+ * @param: cookie - indicates which bluetooth_audio output should handle
+ * @param: allowed - indicates if low latency mode is allowed
+ ***/
+ std::function<void(uint16_t cookie, bool allowed)>
+ low_latency_mode_allowed_cb_;
};
class BluetoothAudioSession {
@@ -155,6 +165,13 @@
void ReportAudioConfigChanged(const AudioConfiguration& audio_config);
/***
+ * The report function is used to report that the Bluetooth stack has notified
+ * the low latency mode allowed changed, and will invoke
+ * low_latency_mode_allowed_changed_cb to notify registered bluetooth_audio
+ * outputs
+ ***/
+ void ReportLowLatencyModeAllowedChanged(bool allowed);
+ /***
* Those control functions are for the bluetooth_audio module to start,
* suspend, stop stream, to check position, and to update metadata.
***/
@@ -164,6 +181,7 @@
bool GetPresentationPosition(PresentationPosition& presentation_position);
void UpdateSourceMetadata(const struct source_metadata& source_metadata);
void UpdateSinkMetadata(const struct sink_metadata& sink_metadata);
+ void SetLatencyMode(LatencyMode latency_mode);
// The control function writes stream to FMQ
size_t OutWritePcmData(const void* buffer, size_t bytes);
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h
index aff01e5..451a31f 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h
@@ -86,6 +86,8 @@
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
return AudioConfiguration(LeAudioConfiguration{});
+ case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
+ return AudioConfiguration(LeAudioBroadcastConfiguration{});
default:
return AudioConfiguration(PcmConfiguration{});
}
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
index 18569c3..03776b5 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionReport.h
@@ -78,6 +78,18 @@
session_ptr->ReportAudioConfigChanged(audio_config);
}
}
+ /***
+ * The API reports the Bluetooth stack has replied the changed of the low
+ * latency audio allowed, and will inform registered bluetooth_audio outputs
+ ***/
+ static void ReportLowLatencyModeAllowedChanged(
+ const SessionType& session_type, bool allowed) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->ReportLowLatencyModeAllowedChanged(allowed);
+ }
+ }
};
} // namespace audio
diff --git a/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp b/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
index 632a389..1ef9365 100644
--- a/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
+++ b/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp
@@ -418,100 +418,89 @@
}
inline Lc3CodecConfig_2_1 to_hidl_leaudio_config_2_1(
- const LeAudioConfiguration& leaudio_config) {
+ const LeAudioConfiguration& unicast_config) {
Lc3CodecConfig_2_1 hidl_lc3_codec_config = {
.audioChannelAllocation = 0,
};
- if (leaudio_config.modeConfig.getTag() ==
- LeAudioConfiguration::LeAudioModeConfig::unicastConfig) {
- auto& unicast_config =
- leaudio_config.modeConfig
- .get<LeAudioConfiguration::LeAudioModeConfig::unicastConfig>();
- if (unicast_config.leAudioCodecConfig.getTag() ==
- LeAudioCodecConfiguration::lc3Config) {
- LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
- }
- auto& le_codec_config = unicast_config.leAudioCodecConfig
- .get<LeAudioCodecConfiguration::lc3Config>();
-
- hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
-
- for (const auto& map : unicast_config.streamMap) {
- hidl_lc3_codec_config.audioChannelAllocation |=
- map.audioChannelAllocation;
- }
- } else {
- // NOTE: Broadcast is not officially supported in HIDL
- auto& bcast_config =
- leaudio_config.modeConfig
- .get<LeAudioConfiguration::LeAudioModeConfig::broadcastConfig>();
- if (bcast_config.streamMap.empty()) {
- return hidl_lc3_codec_config;
- }
- if (bcast_config.streamMap[0].leAudioCodecConfig.getTag() !=
- LeAudioCodecConfiguration::lc3Config) {
- LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
- }
- auto& le_codec_config =
- bcast_config.streamMap[0]
- .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>();
- hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
-
- for (const auto& map : bcast_config.streamMap) {
- hidl_lc3_codec_config.audioChannelAllocation |=
- map.audioChannelAllocation;
- }
+ if (unicast_config.leAudioCodecConfig.getTag() ==
+ LeAudioCodecConfiguration::lc3Config) {
+ LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
}
+ auto& le_codec_config = unicast_config.leAudioCodecConfig
+ .get<LeAudioCodecConfiguration::lc3Config>();
+ hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
+
+ for (const auto& map : unicast_config.streamMap) {
+ hidl_lc3_codec_config.audioChannelAllocation |= map.audioChannelAllocation;
+ }
+ return hidl_lc3_codec_config;
+}
+
+inline Lc3CodecConfig_2_1 to_hidl_leaudio_broadcast_config_2_1(
+ const LeAudioBroadcastConfiguration& broadcast_config) {
+ Lc3CodecConfig_2_1 hidl_lc3_codec_config = {
+ .audioChannelAllocation = 0,
+ };
+ // NOTE: Broadcast is not officially supported in HIDL
+ if (broadcast_config.streamMap.empty()) {
+ return hidl_lc3_codec_config;
+ }
+ if (broadcast_config.streamMap[0].leAudioCodecConfig.getTag() !=
+ LeAudioCodecConfiguration::lc3Config) {
+ LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
+ }
+ auto& le_codec_config =
+ broadcast_config.streamMap[0]
+ .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>();
+ hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
+
+ for (const auto& map : broadcast_config.streamMap) {
+ hidl_lc3_codec_config.audioChannelAllocation |= map.audioChannelAllocation;
+ }
return hidl_lc3_codec_config;
}
inline LeAudioConfig_2_2 to_hidl_leaudio_config_2_2(
- const LeAudioConfiguration& leaudio_config) {
+ const LeAudioConfiguration& unicast_config) {
LeAudioConfig_2_2 hidl_leaudio_config;
+ hidl_leaudio_config.mode = LeAudioMode_2_2::UNICAST;
+ ::android::hardware::bluetooth::audio::V2_2::UnicastConfig
+ hidl_unicast_config;
+ hidl_unicast_config.peerDelay =
+ static_cast<uint32_t>(unicast_config.peerDelayUs / 1000);
- if (leaudio_config.modeConfig.getTag() ==
- LeAudioConfiguration::LeAudioModeConfig::unicastConfig) {
- hidl_leaudio_config.mode = LeAudioMode_2_2::UNICAST;
- auto& unicast_config =
- leaudio_config.modeConfig
- .get<LeAudioConfiguration::LeAudioModeConfig::unicastConfig>();
- ::android::hardware::bluetooth::audio::V2_2::UnicastConfig
- hidl_unicast_config;
- hidl_unicast_config.peerDelay =
- static_cast<uint32_t>(unicast_config.peerDelay);
+ auto& lc3_config = unicast_config.leAudioCodecConfig
+ .get<LeAudioCodecConfiguration::lc3Config>();
+ hidl_unicast_config.lc3Config = to_hidl_lc3_config_2_1(lc3_config);
- auto& lc3_config = unicast_config.leAudioCodecConfig
- .get<LeAudioCodecConfiguration::lc3Config>();
- hidl_unicast_config.lc3Config = to_hidl_lc3_config_2_1(lc3_config);
+ hidl_unicast_config.streamMap.resize(unicast_config.streamMap.size());
+ for (int i = 0; i < unicast_config.streamMap.size(); i++) {
+ hidl_unicast_config.streamMap[i].audioChannelAllocation =
+ static_cast<uint32_t>(
+ unicast_config.streamMap[i].audioChannelAllocation);
+ hidl_unicast_config.streamMap[i].streamHandle =
+ static_cast<uint16_t>(unicast_config.streamMap[i].streamHandle);
+ }
+ return hidl_leaudio_config;
+}
- hidl_unicast_config.streamMap.resize(unicast_config.streamMap.size());
- for (int i = 0; i < unicast_config.streamMap.size(); i++) {
- hidl_unicast_config.streamMap[i].audioChannelAllocation =
- static_cast<uint32_t>(
- unicast_config.streamMap[i].audioChannelAllocation);
- hidl_unicast_config.streamMap[i].streamHandle =
- static_cast<uint16_t>(unicast_config.streamMap[i].streamHandle);
- }
- } else if (leaudio_config.modeConfig.getTag() ==
- LeAudioConfiguration::LeAudioModeConfig::broadcastConfig) {
- hidl_leaudio_config.mode = LeAudioMode_2_2::BROADCAST;
- auto bcast_config =
- leaudio_config.modeConfig
- .get<LeAudioConfiguration::LeAudioModeConfig::broadcastConfig>();
- ::android::hardware::bluetooth::audio::V2_2::BroadcastConfig
- hidl_bcast_config;
- hidl_bcast_config.streamMap.resize(bcast_config.streamMap.size());
- for (int i = 0; i < bcast_config.streamMap.size(); i++) {
- hidl_bcast_config.streamMap[i].audioChannelAllocation =
- static_cast<uint32_t>(
- bcast_config.streamMap[i].audioChannelAllocation);
- hidl_bcast_config.streamMap[i].streamHandle =
- static_cast<uint16_t>(bcast_config.streamMap[i].streamHandle);
- hidl_bcast_config.streamMap[i].lc3Config = to_hidl_lc3_config_2_1(
- bcast_config.streamMap[i]
- .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>());
- }
+inline LeAudioConfig_2_2 to_hidl_leaudio_broadcast_config_2_2(
+ const LeAudioBroadcastConfiguration& broadcast_config) {
+ LeAudioConfig_2_2 hidl_leaudio_config;
+ hidl_leaudio_config.mode = LeAudioMode_2_2::BROADCAST;
+ ::android::hardware::bluetooth::audio::V2_2::BroadcastConfig
+ hidl_bcast_config;
+ hidl_bcast_config.streamMap.resize(broadcast_config.streamMap.size());
+ for (int i = 0; i < broadcast_config.streamMap.size(); i++) {
+ hidl_bcast_config.streamMap[i].audioChannelAllocation =
+ static_cast<uint32_t>(
+ broadcast_config.streamMap[i].audioChannelAllocation);
+ hidl_bcast_config.streamMap[i].streamHandle =
+ static_cast<uint16_t>(broadcast_config.streamMap[i].streamHandle);
+ hidl_bcast_config.streamMap[i].lc3Config = to_hidl_lc3_config_2_1(
+ broadcast_config.streamMap[i]
+ .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>());
}
return hidl_leaudio_config;
}
@@ -532,6 +521,10 @@
hidl_audio_config.leAudioCodecConfig(to_hidl_leaudio_config_2_1(
audio_config.get<AudioConfiguration::leAudioConfig>()));
break;
+ case AudioConfiguration::leAudioBroadcastConfig:
+ hidl_audio_config.leAudioCodecConfig(to_hidl_leaudio_broadcast_config_2_1(
+ audio_config.get<AudioConfiguration::leAudioBroadcastConfig>()));
+ break;
}
return hidl_audio_config;
}
@@ -552,6 +545,10 @@
hidl_audio_config.leAudioConfig(to_hidl_leaudio_config_2_2(
audio_config.get<AudioConfiguration::leAudioConfig>()));
break;
+ case AudioConfiguration::leAudioBroadcastConfig:
+ hidl_audio_config.leAudioConfig(to_hidl_leaudio_broadcast_config_2_2(
+ audio_config.get<AudioConfiguration::leAudioBroadcastConfig>()));
+ break;
}
return hidl_audio_config;
}
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp b/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
index 4c99b0f..decff70 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
+++ b/bluetooth/audio/utils/session/BluetoothAudioSupportedCodecsDB_2_2.cpp
@@ -77,9 +77,13 @@
// Stores the supported setting of audio location, connected device, and the
// channel count for each device
std::vector<std::tuple<AudioLocation, uint8_t, uint8_t>>
- supportedDeviceSetting = {std::make_tuple(stereoAudio, 2, 1),
- std::make_tuple(monoAudio, 1, 2),
- std::make_tuple(monoAudio, 1, 1)};
+ supportedDeviceSetting = {
+ // Stereo, two connected device, one for L one for R
+ std::make_tuple(stereoAudio, 2, 1),
+ // Stereo, one connected device for both L and R
+ std::make_tuple(stereoAudio, 1, 2),
+ // Mono
+ std::make_tuple(monoAudio, 1, 1)};
bool IsOffloadLeAudioConfigurationValid(
const ::android::hardware::bluetooth::audio::V2_1::SessionType&
diff --git a/camera/common/aidl/Android.bp b/camera/common/aidl/Android.bp
index eca70aa..39857ef 100644
--- a/camera/common/aidl/Android.bp
+++ b/camera/common/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.camera.common",
vendor_available: true,
diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp
index b6cbea4..b6f4c58 100644
--- a/camera/device/aidl/Android.bp
+++ b/camera/device/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.camera.device",
vendor_available: true,
diff --git a/camera/metadata/aidl/Android.bp b/camera/metadata/aidl/Android.bp
index 05f280c..c5f16e6 100644
--- a/camera/metadata/aidl/Android.bp
+++ b/camera/metadata/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.camera.metadata",
vendor_available: true,
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index fd961c8..2390f9d 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -222,10 +222,6 @@
<name>android.hardware.drm</name>
<version>1</version>
<interface>
- <name>ICryptoFactory</name>
- <regex-instance>.*</regex-instance>
- </interface>
- <interface>
<name>IDrmFactory</name>
<regex-instance>.*</regex-instance>
</interface>
@@ -385,14 +381,6 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.input.classifier</name>
- <version>1.0</version>
- <interface>
- <name>IInputClassifier</name>
- <instance>default</instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.input.processor</name>
<version>1</version>
@@ -841,14 +829,6 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi.hostapd</name>
- <version>1.0-3</version>
- <interface>
- <name>IHostapd</name>
- <instance>default</instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.wifi.hostapd</name>
<version>1</version>
@@ -857,14 +837,6 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi.supplicant</name>
- <version>1.2-4</version>
- <interface>
- <name>ISupplicant</name>
- <instance>default</instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.wifi.supplicant</name>
<interface>
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl
similarity index 87%
copy from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
copy to drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl
index d2b48d2..ea736cf 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl
@@ -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.
@@ -33,7 +33,9 @@
package android.hardware.drm;
@VintfStability
-parcelable DecryptResult {
- int bytesWritten;
- String detailedError;
+parcelable CryptoSchemes {
+ List<android.hardware.drm.Uuid> uuids;
+ android.hardware.drm.SecurityLevel minLevel;
+ android.hardware.drm.SecurityLevel maxLevel;
+ List<String> mimeTypes;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.aidl
similarity index 82%
copy from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl
copy to drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.aidl
index 0d4296e..9c574a4 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoFactory.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.aidl
@@ -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.
@@ -33,7 +33,14 @@
package android.hardware.drm;
@VintfStability
-interface ICryptoFactory {
- @nullable android.hardware.drm.ICryptoPlugin createPlugin(in android.hardware.drm.Uuid uuid, in byte[] initData);
- boolean isCryptoSchemeSupported(in android.hardware.drm.Uuid uuid);
+parcelable DecryptArgs {
+ boolean secure;
+ byte[] keyId;
+ byte[] iv;
+ android.hardware.drm.Mode mode;
+ android.hardware.drm.Pattern pattern;
+ android.hardware.drm.SubSample[] subSamples;
+ android.hardware.drm.SharedBuffer source;
+ long offset;
+ android.hardware.drm.DestinationBuffer destination;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl
index 4f2d133..8c3ba7d 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl
@@ -33,8 +33,7 @@
package android.hardware.drm;
@VintfStability
-parcelable DestinationBuffer {
- android.hardware.drm.BufferType type;
+union DestinationBuffer {
android.hardware.drm.SharedBuffer nonsecureMemory;
android.hardware.common.NativeHandle secureMemory;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl
index 2224795..31c45e0 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl
@@ -34,10 +34,10 @@
package android.hardware.drm;
@VintfStability
interface ICryptoPlugin {
- android.hardware.drm.DecryptResult decrypt(in boolean secure, in byte[] keyId, in byte[] iv, in android.hardware.drm.Mode mode, in android.hardware.drm.Pattern pattern, in android.hardware.drm.SubSample[] subSamples, in android.hardware.drm.SharedBuffer source, in long offset, in android.hardware.drm.DestinationBuffer destination);
+ int decrypt(in android.hardware.drm.DecryptArgs args);
List<android.hardware.drm.LogMessage> getLogMessages();
void notifyResolution(in int width, in int height);
boolean requiresSecureDecoderComponent(in String mime);
void setMediaDrmSession(in byte[] sessionId);
- void setSharedBufferBase(in android.hardware.common.Ashmem base, in int bufferId);
+ void setSharedBufferBase(in android.hardware.drm.SharedBuffer base);
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl
index af48737..82efbb7 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl
@@ -34,8 +34,7 @@
package android.hardware.drm;
@VintfStability
interface IDrmFactory {
- @nullable android.hardware.drm.IDrmPlugin createPlugin(in android.hardware.drm.Uuid uuid, in String appPackageName);
- List<android.hardware.drm.Uuid> getSupportedCryptoSchemes();
- boolean isContentTypeSupported(in String mimeType);
- boolean isCryptoSchemeSupported(in android.hardware.drm.Uuid uuid, in String mimeType, in android.hardware.drm.SecurityLevel securityLevel);
+ @nullable android.hardware.drm.IDrmPlugin createDrmPlugin(in android.hardware.drm.Uuid uuid, in String appPackageName);
+ @nullable android.hardware.drm.ICryptoPlugin createCryptoPlugin(in android.hardware.drm.Uuid uuid, in byte[] initData);
+ android.hardware.drm.CryptoSchemes getSupportedCryptoSchemes();
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl
index 5f839d7..ae10062 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl
@@ -63,7 +63,6 @@
void removeOfflineLicense(in android.hardware.drm.KeySetId keySetId);
void removeSecureStop(in android.hardware.drm.SecureStopId secureStopId);
boolean requiresSecureDecoder(in String mime, in android.hardware.drm.SecurityLevel level);
- boolean requiresSecureDecoderDefault(in String mime);
void restoreKeys(in byte[] sessionId, in android.hardware.drm.KeySetId keySetId);
void setCipherAlgorithm(in byte[] sessionId, in String algorithm);
void setListener(in android.hardware.drm.IDrmPluginListener listener);
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl
index e88d388..261516f 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl
@@ -36,8 +36,8 @@
enum KeyStatusType {
USABLE = 0,
EXPIRED = 1,
- OUTPUTNOTALLOWED = 2,
- STATUSPENDING = 3,
- INTERNALERROR = 4,
- USABLEINFUTURE = 5,
+ OUTPUT_NOT_ALLOWED = 2,
+ STATUS_PENDING = 3,
+ INTERNAL_ERROR = 4,
+ USABLE_IN_FUTURE = 5,
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl
index 973ef0d..314fe7c 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl
@@ -37,4 +37,5 @@
int bufferId;
long offset;
long size;
+ android.hardware.common.NativeHandle handle;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl
index ec2eb16..3c2cfa20 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl
+++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl
@@ -34,5 +34,5 @@
package android.hardware.drm;
@VintfStability
parcelable Uuid {
- byte[] uuid;
+ byte[16] uuid;
}
diff --git a/drm/aidl/android/hardware/drm/BufferType.aidl b/drm/aidl/android/hardware/drm/BufferType.aidl
deleted file mode 100644
index 089c950..0000000
--- a/drm/aidl/android/hardware/drm/BufferType.aidl
+++ /dev/null
@@ -1,24 +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.drm;
-
-@VintfStability
-@Backing(type="int")
-enum BufferType {
- SHARED_MEMORY = 0,
- NATIVE_HANDLE = 1,
-}
diff --git a/drm/aidl/android/hardware/drm/CryptoSchemes.aidl b/drm/aidl/android/hardware/drm/CryptoSchemes.aidl
new file mode 100644
index 0000000..b4b34ec
--- /dev/null
+++ b/drm/aidl/android/hardware/drm/CryptoSchemes.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.drm;
+
+import android.hardware.drm.SecurityLevel;
+import android.hardware.drm.Uuid;
+
+@VintfStability
+parcelable CryptoSchemes {
+
+ /**
+ * Supported crypto schemes
+ */
+ List<Uuid> uuids;
+
+ /**
+ * Minimum supported security level (inclusive)
+ */
+ SecurityLevel minLevel;
+
+ /**
+ * Maximum supported security level (inclusive)
+ */
+ SecurityLevel maxLevel;
+
+ /**
+ * Supported mime types
+ */
+ List<String> mimeTypes;
+
+}
diff --git a/drm/aidl/android/hardware/drm/DecryptArgs.aidl b/drm/aidl/android/hardware/drm/DecryptArgs.aidl
new file mode 100644
index 0000000..5ec1b71
--- /dev/null
+++ b/drm/aidl/android/hardware/drm/DecryptArgs.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.drm;
+
+import android.hardware.drm.DestinationBuffer;
+import android.hardware.drm.KeyStatusType;
+import android.hardware.drm.Mode;
+import android.hardware.drm.Pattern;
+import android.hardware.drm.SharedBuffer;
+import android.hardware.drm.SubSample;
+
+/**
+ * Arguments to ICryptoPlugin decrypt
+ */
+@VintfStability
+parcelable DecryptArgs {
+
+ /**
+ * A flag to indicate if a secure decoder is being used.
+ *
+ * This enables the plugin to configure buffer modes to work consistently
+ * with a secure decoder.
+ */
+ boolean secure;
+
+ /**
+ * The keyId for the key that is used to do the decryption.
+ *
+ * The keyId refers to a key in the associated MediaDrm instance.
+ */
+ byte[] keyId;
+
+ /**
+ * The initialization vector
+ */
+ byte[] iv;
+
+ /**
+ * Crypto mode
+ */
+ Mode mode;
+
+ /**
+ * Crypto pattern
+ */
+ Pattern pattern;
+
+ /**
+ * A vector of subsamples indicating the number of clear and encrypted
+ * bytes to process.
+ *
+ * This allows the decrypt call to operate on a range of subsamples in a
+ * single call
+ */
+ SubSample[] subSamples;
+
+ /**
+ * Input buffer for the decryption
+ */
+ SharedBuffer source;
+
+ /**
+ * The offset of the first byte of encrypted data from the base of the
+ * source buffer
+ */
+ long offset;
+
+ /**
+ * Output buffer for the decryption
+ */
+ DestinationBuffer destination;
+
+}
diff --git a/drm/aidl/android/hardware/drm/DestinationBuffer.aidl b/drm/aidl/android/hardware/drm/DestinationBuffer.aidl
index 0f1e3f5..7fc61e1 100644
--- a/drm/aidl/android/hardware/drm/DestinationBuffer.aidl
+++ b/drm/aidl/android/hardware/drm/DestinationBuffer.aidl
@@ -17,29 +17,24 @@
package android.hardware.drm;
import android.hardware.common.NativeHandle;
-import android.hardware.drm.BufferType;
import android.hardware.drm.SharedBuffer;
/**
* A decrypt destination buffer can be either normal user-space shared
* memory for the non-secure decrypt case, or it can be a secure buffer
- * which is referenced by a native-handle. The native handle is allocated
- * by the vendor's buffer allocator.
+ * which is referenced by a native-handle.
+ *
+ * The native handle is allocated by the vendor's buffer allocator.
*/
@VintfStability
-parcelable DestinationBuffer {
+union DestinationBuffer {
/**
- * The type of the buffer
- */
- BufferType type;
- /**
- * If type == SHARED_MEMORY, the decrypted data must be written
- * to user-space non-secure shared memory.
+ * decrypted data written to user-space non-secure shared memory.
*/
SharedBuffer nonsecureMemory;
/**
- * If type == NATIVE_HANDLE, the decrypted data must be written
- * to secure memory referenced by the vendor's buffer allocator.
+ * decrypted data written to secure memory referenced by the vendor's
+ * buffer allocator.
*/
NativeHandle secureMemory;
}
diff --git a/drm/aidl/android/hardware/drm/ICryptoFactory.aidl b/drm/aidl/android/hardware/drm/ICryptoFactory.aidl
deleted file mode 100644
index 202bd3d..0000000
--- a/drm/aidl/android/hardware/drm/ICryptoFactory.aidl
+++ /dev/null
@@ -1,51 +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.drm;
-
-import android.hardware.drm.Uuid;
-
-/**
- * ICryptoFactory is the main entry point for interacting with a vendor's
- * crypto HAL to create crypto plugins.
-
- * Crypto plugins create crypto sessions which are used by a codec to decrypt
- * protected video content.
- */
-@VintfStability
-interface ICryptoFactory {
- /**
- * Create a crypto plugin for the specified uuid and scheme-specific
- * initialization data.
- *
- * @param uuid uniquely identifies the drm scheme. See
- * http://dashif.org/identifiers/protection for uuid assignments
- *
- * @param initData scheme-specific init data.
- *
- * @return A crypto plugin instance if successful, or null if not created.
- */
- @nullable android.hardware.drm.ICryptoPlugin createPlugin(
- in Uuid uuid, in byte[] initData);
-
- /**
- * Determine if a crypto scheme is supported by this HAL.
- *
- * @param uuid identifies the crypto scheme in question
- * @return must be true only if the scheme is supported
- */
- boolean isCryptoSchemeSupported(in Uuid uuid);
-}
diff --git a/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl b/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl
index 80a63df..d344b62 100644
--- a/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl
+++ b/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl
@@ -17,7 +17,7 @@
package android.hardware.drm;
import android.hardware.common.Ashmem;
-import android.hardware.drm.DecryptResult;
+import android.hardware.drm.DecryptArgs;
import android.hardware.drm.DestinationBuffer;
import android.hardware.drm.LogMessage;
import android.hardware.drm.Mode;
@@ -38,23 +38,7 @@
* Decrypt an array of subsamples from the source memory buffer to the
* destination memory buffer.
*
- * @param secure a flag to indicate if a secure decoder is being used.
- * This enables the plugin to configure buffer modes to work
- * consistently with a secure decoder.
- * @param the keyId for the key that is used to do the decryption. The
- * keyId refers to a key in the associated MediaDrm instance.
- * @param iv the initialization vector to use
- * @param mode the crypto mode to use
- * @param pattern the crypto pattern to use
- * @param subSamples a vector of subsamples indicating the number
- * of clear and encrypted bytes to process. This allows the decrypt
- * call to operate on a range of subsamples in a single call
- * @param source the input buffer for the decryption
- * @param offset the offset of the first byte of encrypted data from
- * the base of the source buffer
- * @param destination the output buffer for the decryption
- *
- * @return DecryptResult parcelable
+ * @return number of decrypted bytes
* Implicit error codes:
* + ERROR_DRM_CANNOT_HANDLE in other failure cases
* + ERROR_DRM_DECRYPT if the decrypt operation fails
@@ -74,9 +58,7 @@
* + ERROR_DRM_SESSION_NOT_OPENED if the decrypt session is not
* opened
*/
- DecryptResult decrypt(in boolean secure, in byte[] keyId, in byte[] iv, in Mode mode,
- in Pattern pattern, in SubSample[] subSamples, in SharedBuffer source, in long offset,
- in DestinationBuffer destination);
+ int decrypt(in DecryptArgs args);
/**
* Get OEMCrypto or plugin error messages.
@@ -129,10 +111,8 @@
* There can be multiple shared buffers per crypto plugin. The buffers
* are distinguished by the bufferId.
*
- * @param base the base of the memory buffer identified by
- * bufferId
- * @param bufferId identifies the specific shared buffer for which
- * the base is being set.
+ * @param base the base of the memory buffer abstracted by
+ * SharedBuffer parcelable (bufferId, size, handle)
*/
- void setSharedBufferBase(in Ashmem base, in int bufferId);
+ void setSharedBufferBase(in SharedBuffer base);
}
diff --git a/drm/aidl/android/hardware/drm/IDrmFactory.aidl b/drm/aidl/android/hardware/drm/IDrmFactory.aidl
index b9622a4..86c3f21 100644
--- a/drm/aidl/android/hardware/drm/IDrmFactory.aidl
+++ b/drm/aidl/android/hardware/drm/IDrmFactory.aidl
@@ -16,6 +16,7 @@
package android.hardware.drm;
+import android.hardware.drm.CryptoSchemes;
import android.hardware.drm.SecurityLevel;
import android.hardware.drm.Uuid;
@@ -40,37 +41,30 @@
* Implicit error codes:
* + ERROR_DRM_CANNOT_HANDLE if the plugin cannot be created.
*/
- @nullable android.hardware.drm.IDrmPlugin createPlugin(
+ @nullable android.hardware.drm.IDrmPlugin createDrmPlugin(
in Uuid uuid, in String appPackageName);
/**
+ * Create a crypto plugin for the specified uuid and scheme-specific
+ * initialization data.
+ *
+ * @param uuid uniquely identifies the drm scheme. See
+ * http://dashif.org/identifiers/protection for uuid assignments
+ *
+ * @param initData scheme-specific init data.
+ *
+ * @return A crypto plugin instance if successful, or null if not created.
+ */
+ @nullable android.hardware.drm.ICryptoPlugin createCryptoPlugin(
+ in Uuid uuid, in byte[] initData);
+
+ /**
* Return vector of uuids identifying crypto schemes supported by
* this HAL.
*
* @return List of uuids for which isCryptoSchemeSupported is true;
* each uuid can be used as input to createPlugin.
*/
- List<Uuid> getSupportedCryptoSchemes();
+ CryptoSchemes getSupportedCryptoSchemes();
- /**
- * Determine if the HAL factory is able to construct plugins that
- * support a given media container format specified by mimeType
- *
- * @param mimeType identifies the mime type in question
- *
- * @return must be true only if the scheme is supported
- */
- boolean isContentTypeSupported(in String mimeType);
-
- /**
- * Determine if a specific security level is supported by the device.
- *
- * @param uuid identifies the crypto scheme in question
- * @param mimeType identifies the mime type in question
- * @param securityLevel specifies the security level required
- *
- * @return must be true only if the scheme is supported
- */
- boolean isCryptoSchemeSupported(
- in Uuid uuid, in String mimeType, in SecurityLevel securityLevel);
}
diff --git a/drm/aidl/android/hardware/drm/IDrmPlugin.aidl b/drm/aidl/android/hardware/drm/IDrmPlugin.aidl
index e649f26..11ca8b6 100644
--- a/drm/aidl/android/hardware/drm/IDrmPlugin.aidl
+++ b/drm/aidl/android/hardware/drm/IDrmPlugin.aidl
@@ -577,17 +577,6 @@
boolean requiresSecureDecoder(in String mime, in SecurityLevel level);
/**
- * Check if the specified mime-type requires a secure decoder component
- * at the highest security level supported on the device.
- *
- * @param mime The content mime-type
- *
- * @return must be true if and only if a secure decoder is required
- * for the specified mime-type
- */
- boolean requiresSecureDecoderDefault(in String mime);
-
- /**
* Restore persisted offline keys into a new session
*
* @param sessionId the session id the call applies to
diff --git a/drm/aidl/android/hardware/drm/KeyStatusType.aidl b/drm/aidl/android/hardware/drm/KeyStatusType.aidl
index 6902d87..6c3c6a2 100644
--- a/drm/aidl/android/hardware/drm/KeyStatusType.aidl
+++ b/drm/aidl/android/hardware/drm/KeyStatusType.aidl
@@ -32,20 +32,20 @@
* The key is not currently usable to decrypt media data because its output
* requirements cannot currently be met.
*/
- OUTPUTNOTALLOWED,
+ OUTPUT_NOT_ALLOWED,
/**
* The status of the key is not yet known and is being determined.
*/
- STATUSPENDING,
+ STATUS_PENDING,
/**
* The key is not currently usable to decrypt media data because of an
* internal error in processing unrelated to input parameters.
*/
- INTERNALERROR,
+ INTERNAL_ERROR,
/**
* The key is not yet usable to decrypt media because the start
* time is in the future. The key must become usable when
* its start time is reached.
*/
- USABLEINFUTURE,
+ USABLE_IN_FUTURE,
}
diff --git a/drm/aidl/android/hardware/drm/SharedBuffer.aidl b/drm/aidl/android/hardware/drm/SharedBuffer.aidl
index 6977284..2b2610f 100644
--- a/drm/aidl/android/hardware/drm/SharedBuffer.aidl
+++ b/drm/aidl/android/hardware/drm/SharedBuffer.aidl
@@ -16,6 +16,8 @@
package android.hardware.drm;
+import android.hardware.common.NativeHandle;
+
/**
* SharedBuffer describes a decrypt buffer which is defined by a bufferId, an
* offset and a size. The offset is relative to the shared memory base for the
@@ -36,4 +38,8 @@
* The size of the shared buffer in bytes
*/
long size;
+ /**
+ * Handle to shared memory
+ */
+ NativeHandle handle;
}
diff --git a/drm/aidl/android/hardware/drm/Uuid.aidl b/drm/aidl/android/hardware/drm/Uuid.aidl
index b36c409..db5a70d 100644
--- a/drm/aidl/android/hardware/drm/Uuid.aidl
+++ b/drm/aidl/android/hardware/drm/Uuid.aidl
@@ -18,5 +18,5 @@
@VintfStability
parcelable Uuid {
- byte[] uuid;
+ byte[16] uuid;
}
diff --git a/drm/aidl/vts/Android.bp b/drm/aidl/vts/Android.bp
index 5b41830..190f60d 100644
--- a/drm/aidl/vts/Android.bp
+++ b/drm/aidl/vts/Android.bp
@@ -49,6 +49,8 @@
"android.hardware.drm@1.0-helper",
"android.hardware.drm-V1-ndk",
"android.hardware.common-V2-ndk",
+ "libaidlcommonsupport",
+ "libgmock_ndk",
"libdrmvtshelper",
"libvtsclearkey",
],
diff --git a/drm/aidl/vts/drm_hal_common.cpp b/drm/aidl/vts/drm_hal_common.cpp
index 751c25b..9b315f4 100644
--- a/drm/aidl/vts/drm_hal_common.cpp
+++ b/drm/aidl/vts/drm_hal_common.cpp
@@ -22,9 +22,11 @@
#include <sys/mman.h>
#include <random>
+#include <aidlcommonsupport/NativeHandle.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <android/sharedmem.h>
+#include <cutils/native_handle.h>
#include "drm_hal_clearkey_module.h"
#include "drm_hal_common.h"
@@ -39,8 +41,7 @@
using std::vector;
using ::aidl::android::hardware::common::Ashmem;
-using ::aidl::android::hardware::drm::BufferType;
-using ::aidl::android::hardware::drm::DecryptResult;
+using ::aidl::android::hardware::drm::DecryptArgs;
using ::aidl::android::hardware::drm::DestinationBuffer;
using ::aidl::android::hardware::drm::EventType;
using ::aidl::android::hardware::drm::ICryptoPlugin;
@@ -72,7 +73,6 @@
}
const char* kDrmIface = "android.hardware.drm.IDrmFactory";
-const char* kCryptoIface = "android.hardware.drm.ICryptoFactory";
std::string HalFullName(const std::string& iface, const std::string& basename) {
return iface + '/' + basename;
@@ -184,7 +184,6 @@
test_info->name(), GetParamService().c_str());
auto svc = GetParamService();
- const string cryptoInstance = HalFullName(kCryptoIface, svc);
const string drmInstance = HalFullName(kDrmIface, svc);
if (drmInstance.find("IDrmFactory") != std::string::npos) {
@@ -192,12 +191,6 @@
::ndk::SpAIBinder(AServiceManager_waitForService(drmInstance.c_str())));
ASSERT_NE(drmFactory, nullptr);
drmPlugin = createDrmPlugin();
- }
-
- if (cryptoInstance.find("ICryptoFactory") != std::string::npos) {
- cryptoFactory = ICryptoFactory::fromBinder(
- ::ndk::SpAIBinder(AServiceManager_waitForService(cryptoInstance.c_str())));
- ASSERT_NE(cryptoFactory, nullptr);
cryptoPlugin = createCryptoPlugin();
}
@@ -211,14 +204,12 @@
contentConfigurations = vendorModule->getContentConfigurations();
// If drm scheme not installed skip subsequent tests
- bool result = false;
- drmFactory->isCryptoSchemeSupported({getUUID()}, "cenc", SecurityLevel::SW_SECURE_CRYPTO,
- &result);
+ bool result = isCryptoSchemeSupported(getAidlUUID(), SecurityLevel::SW_SECURE_CRYPTO, "cenc");
if (!result) {
if (GetParamUUID() == std::array<uint8_t, 16>()) {
GTEST_SKIP() << "vendor module drm scheme not supported";
} else {
- FAIL() << "param scheme must not supported";
+ FAIL() << "param scheme must be supported";
}
}
@@ -234,18 +225,18 @@
}
std::string packageName("aidl.android.hardware.drm.test");
std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin> result;
- auto ret = drmFactory->createPlugin({getUUID()}, packageName, &result);
+ auto ret = drmFactory->createDrmPlugin(getAidlUUID(), packageName, &result);
EXPECT_OK(ret) << "createDrmPlugin remote call failed";
return result;
}
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> DrmHalTest::createCryptoPlugin() {
- if (cryptoFactory == nullptr) {
+ if (drmFactory == nullptr) {
return nullptr;
}
vector<uint8_t> initVec;
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> result;
- auto ret = cryptoFactory->createPlugin({getUUID()}, initVec, &result);
+ auto ret = drmFactory->createCryptoPlugin(getAidlUUID(), initVec, &result);
EXPECT_OK(ret) << "createCryptoPlugin remote call failed";
return result;
}
@@ -270,6 +261,26 @@
return vendorModule->getUUID();
}
+bool DrmHalTest::isCryptoSchemeSupported(Uuid uuid, SecurityLevel level, std::string mime) {
+ CryptoSchemes schemes{};
+ auto ret = drmFactory->getSupportedCryptoSchemes(&schemes);
+ EXPECT_OK(ret);
+ 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()) {
+ if (!std::count(schemes.mimeTypes.begin(), schemes.mimeTypes.end(), mime)) {
+ return false;
+ }
+ }
+ return true;
+}
+
void DrmHalTest::provision() {
std::string certificateType;
std::string certificateAuthority;
@@ -410,38 +421,43 @@
/**
* getDecryptMemory allocates memory for decryption, then sets it
- * as a shared buffer base in the crypto hal. A parcelable Ashmem
- * is returned.
+ * as a shared buffer base in the crypto hal. An output SharedBuffer
+ * is updated via reference.
*
* @param size the size of the memory segment to allocate
* @param the index of the memory segment which will be used
* to refer to it for decryption.
*/
-Ashmem DrmHalTest::getDecryptMemory(size_t size, size_t index) {
+void DrmHalTest::getDecryptMemory(size_t size, size_t index, SharedBuffer& out) {
+ out.bufferId = static_cast<int32_t>(index);
+ out.offset = 0;
+ out.size = static_cast<int64_t>(size);
+
int fd = ASharedMemory_create("drmVtsSharedMemory", size);
EXPECT_GE(fd, 0);
EXPECT_EQ(size, ASharedMemory_getSize(fd));
+ auto handle = native_handle_create(1, 0);
+ handle->data[0] = fd;
+ out.handle = ::android::makeToAidl(handle);
- Ashmem ashmem;
- ashmem.fd = ::ndk::ScopedFileDescriptor(fd);
- ashmem.size = size;
- EXPECT_OK(cryptoPlugin->setSharedBufferBase(ashmem, index));
- return ashmem;
+ EXPECT_OK(cryptoPlugin->setSharedBufferBase(out));
+ native_handle_delete(handle);
}
-void DrmHalTest::fillRandom(const Ashmem& ashmem) {
+uint8_t* DrmHalTest::fillRandom(const ::aidl::android::hardware::drm::SharedBuffer& buf) {
std::random_device rd;
std::mt19937 rand(rd());
- ::ndk::ScopedFileDescriptor fd = ashmem.fd.dup();
- size_t size = ashmem.size;
+ auto fd = buf.handle.fds[0].get();
+ size_t size = buf.size;
uint8_t* base = static_cast<uint8_t*>(
- mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0));
+ mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
EXPECT_NE(MAP_FAILED, base);
for (size_t i = 0; i < size / sizeof(uint32_t); i++) {
auto p = static_cast<uint32_t*>(static_cast<void*>(base));
p[i] = rand();
}
+ return base;
}
uint32_t DrmHalTest::decrypt(Mode mode, bool isSecure, const std::array<uint8_t, 16>& keyId,
@@ -453,6 +469,7 @@
uint8_t localIv[AES_BLOCK_SIZE];
memcpy(localIv, iv, AES_BLOCK_SIZE);
vector<uint8_t> ivVec(localIv, localIv + AES_BLOCK_SIZE);
+ vector<uint8_t> keyIdVec(keyId.begin(), keyId.end());
int64_t totalSize = 0;
for (size_t i = 0; i < subSamples.size(); i++) {
@@ -463,32 +480,39 @@
// The first totalSize bytes of shared memory is the encrypted
// input, the second totalSize bytes (if exists) is the decrypted output.
size_t factor = expectedStatus == Status::ERROR_DRM_FRAME_TOO_LARGE ? 1 : 2;
- Ashmem sharedMemory = getDecryptMemory(totalSize * factor, kSegmentIndex);
+ SharedBuffer sourceBuffer;
+ getDecryptMemory(totalSize * factor, kSegmentIndex, sourceBuffer);
+ auto base = fillRandom(sourceBuffer);
- const SharedBuffer sourceBuffer = {.bufferId = kSegmentIndex, .offset = 0, .size = totalSize};
- fillRandom(sharedMemory);
+ SharedBuffer sourceRange;
+ sourceRange.bufferId = kSegmentIndex;
+ sourceRange.offset = 0;
+ sourceRange.size = totalSize;
- const DestinationBuffer destBuffer = {
- .type = BufferType::SHARED_MEMORY,
- .nonsecureMemory = {.bufferId = kSegmentIndex, .offset = totalSize, .size = totalSize},
- .secureMemory = {.fds = {}, .ints = {}}};
- const uint64_t offset = 0;
- uint32_t bytesWritten = 0;
- vector<uint8_t> keyIdVec(keyId.begin(), keyId.end());
- DecryptResult result;
- auto ret = cryptoPlugin->decrypt(isSecure, keyIdVec, ivVec, mode, pattern, subSamples,
- sourceBuffer, offset, destBuffer, &result);
+ SharedBuffer destRange;
+ destRange.bufferId = kSegmentIndex;
+ destRange.offset = totalSize;
+ destRange.size = totalSize;
+
+ DecryptArgs args;
+ args.secure = isSecure;
+ args.keyId = keyIdVec;
+ args.iv = ivVec;
+ args.mode = mode;
+ args.pattern = pattern;
+ args.subSamples = subSamples;
+ args.source = std::move(sourceRange);
+ args.offset = 0;
+ args.destination = std::move(destRange);
+
+ int32_t bytesWritten = 0;
+ auto ret = cryptoPlugin->decrypt(args, &bytesWritten);
EXPECT_TXN(ret);
- EXPECT_EQ(expectedStatus, DrmErr(ret)) << "Unexpected decrypt status " << result.detailedError;
- bytesWritten = result.bytesWritten;
+ EXPECT_EQ(expectedStatus, DrmErr(ret)) << "Unexpected decrypt status " << ret.getMessage();
if (bytesWritten != totalSize) {
return bytesWritten;
}
- ::ndk::ScopedFileDescriptor fd = sharedMemory.fd.dup();
- uint8_t* base = static_cast<uint8_t*>(
- mmap(nullptr, totalSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0));
- EXPECT_NE(MAP_FAILED, base);
// generate reference vector
vector<uint8_t> reference(totalSize);
@@ -513,6 +537,7 @@
EXPECT_EQ(0, memcmp(static_cast<void*>(&reference[0]), static_cast<void*>(base + totalSize),
totalSize))
<< "decrypt data mismatch";
+ munmap(base, totalSize * factor);
return totalSize;
}
diff --git a/drm/aidl/vts/drm_hal_test.cpp b/drm/aidl/vts/drm_hal_test.cpp
index 3ac9f5c..266ea39 100644
--- a/drm/aidl/vts/drm_hal_test.cpp
+++ b/drm/aidl/vts/drm_hal_test.cpp
@@ -66,11 +66,8 @@
* Ensure drm factory supports module UUID Scheme
*/
TEST_P(DrmHalTest, VendorUuidSupported) {
- bool result = false;
- auto ret =
- drmFactory->isCryptoSchemeSupported(getAidlUUID(), kVideoMp4, kSwSecureCrypto, &result);
- ALOGI("kVideoMp4 = %s res %d", kVideoMp4, static_cast<bool>(result));
- EXPECT_OK(ret);
+ bool result = isCryptoSchemeSupported(getAidlUUID(), kSwSecureCrypto, kVideoMp4);
+ ALOGI("kVideoMp4 = %s res %d", kVideoMp4, result);
EXPECT_TRUE(result);
}
@@ -80,10 +77,7 @@
TEST_P(DrmHalTest, InvalidPluginNotSupported) {
const vector<uint8_t> kInvalidUUID = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};
- bool result = false;
- auto ret = drmFactory->isCryptoSchemeSupported(toAidlUuid(kInvalidUUID), kVideoMp4,
- kSwSecureCrypto, &result);
- EXPECT_OK(ret);
+ auto result = isCryptoSchemeSupported(toAidlUuid(kInvalidUUID), kSwSecureCrypto, kVideoMp4);
EXPECT_FALSE(result);
}
@@ -93,10 +87,7 @@
TEST_P(DrmHalTest, EmptyPluginUUIDNotSupported) {
vector<uint8_t> emptyUUID(16);
memset(emptyUUID.data(), 0, 16);
- bool result = false;
- auto ret = drmFactory->isCryptoSchemeSupported(toAidlUuid(emptyUUID), kVideoMp4,
- kSwSecureCrypto, &result);
- EXPECT_OK(ret);
+ auto result = isCryptoSchemeSupported(toAidlUuid(emptyUUID), kSwSecureCrypto, kVideoMp4);
EXPECT_FALSE(result);
}
@@ -104,10 +95,7 @@
* Ensure drm factory doesn't support an invalid mime type
*/
TEST_P(DrmHalTest, BadMimeNotSupported) {
- bool result = false;
- auto ret =
- drmFactory->isCryptoSchemeSupported(getAidlUUID(), kBadMime, kSwSecureCrypto, &result);
- EXPECT_OK(ret);
+ auto result = isCryptoSchemeSupported(getAidlUUID(), kSwSecureCrypto, kBadMime);
EXPECT_FALSE(result);
}
@@ -380,9 +368,7 @@
* Ensure clearkey drm factory doesn't support security level higher than supported
*/
TEST_P(DrmHalClearkeyTest, BadLevelNotSupported) {
- bool result = false;
- auto ret = drmFactory->isCryptoSchemeSupported(getAidlUUID(), kVideoMp4, kHwSecureAll, &result);
- EXPECT_OK(ret);
+ auto result = isCryptoSchemeSupported(getAidlUUID(), kHwSecureAll, kVideoMp4);
EXPECT_FALSE(result);
}
@@ -461,7 +447,7 @@
const vector<KeyStatus> keyStatusList = {
{{0xa, 0xb, 0xc}, KeyStatusType::USABLE},
{{0xd, 0xe, 0xf}, KeyStatusType::EXPIRED},
- {{0x0, 0x1, 0x2}, KeyStatusType::USABLEINFUTURE},
+ {{0x0, 0x1, 0x2}, KeyStatusType::USABLE_IN_FUTURE},
};
EXPECT_EQ(sessionId, args.sessionId);
EXPECT_EQ(keyStatusList, args.keyStatusList);
diff --git a/drm/aidl/vts/drm_hal_test_main.cpp b/drm/aidl/vts/drm_hal_test_main.cpp
index dc0f6d7..833a51a 100644
--- a/drm/aidl/vts/drm_hal_test_main.cpp
+++ b/drm/aidl/vts/drm_hal_test_main.cpp
@@ -42,21 +42,15 @@
using drm_vts::PrintParamInstanceToString;
static const std::vector<DrmHalTestParam> getAllInstances() {
- using ::aidl::android::hardware::drm::ICryptoFactory;
using ::aidl::android::hardware::drm::IDrmFactory;
std::vector<std::string> drmInstances =
android::getAidlHalInstanceNames(IDrmFactory::descriptor);
- std::vector<std::string> cryptoInstances =
- android::getAidlHalInstanceNames(ICryptoFactory::descriptor);
std::set<std::string> allInstances;
for (auto svc : drmInstances) {
allInstances.insert(HalBaseName(svc));
}
- for (auto svc : cryptoInstances) {
- allInstances.insert(HalBaseName(svc));
- }
std::vector<DrmHalTestParam> allInstanceUuidCombos;
auto noUUID = [](std::string s) { return DrmHalTestParam(s); };
diff --git a/drm/aidl/vts/include/drm_hal_common.h b/drm/aidl/vts/include/drm_hal_common.h
index 4aac48b..2c7e514 100644
--- a/drm/aidl/vts/include/drm_hal_common.h
+++ b/drm/aidl/vts/include/drm_hal_common.h
@@ -18,14 +18,17 @@
#include <aidl/android/hardware/common/Ashmem.h>
#include <aidl/android/hardware/drm/BnDrmPluginListener.h>
-#include <aidl/android/hardware/drm/ICryptoFactory.h>
#include <aidl/android/hardware/drm/ICryptoPlugin.h>
#include <aidl/android/hardware/drm/IDrmFactory.h>
#include <aidl/android/hardware/drm/IDrmPlugin.h>
#include <aidl/android/hardware/drm/IDrmPluginListener.h>
#include <aidl/android/hardware/drm/Status.h>
+#include <android/binder_auto_utils.h>
+
+#include <gmock/gmock.h>
#include <array>
+#include <algorithm>
#include <chrono>
#include <future>
#include <iostream>
@@ -35,8 +38,6 @@
#include <utility>
#include <vector>
-#include <android/binder_auto_utils.h>
-
#include "VtsHalHidlTargetCallbackBase.h"
#include "drm_hal_vendor_module_api.h"
#include "drm_vts_helper.h"
@@ -80,11 +81,14 @@
std::array<uint8_t, 16> GetParamUUID() { return GetParam().scheme_; }
std::string GetParamService() { return GetParam().instance_; }
::aidl::android::hardware::drm::Uuid toAidlUuid(const std::vector<uint8_t>& in_uuid) {
- ::aidl::android::hardware::drm::Uuid uuid;
- uuid.uuid = in_uuid;
- return uuid;
+ std::array<uint8_t, 16> a;
+ std::copy_n(in_uuid.begin(), a.size(), a.begin());
+ return {a};
}
+ bool isCryptoSchemeSupported(::aidl::android::hardware::drm::Uuid uuid,
+ ::aidl::android::hardware::drm::SecurityLevel level,
+ std::string mime);
void provision();
SessionId openSession(::aidl::android::hardware::drm::SecurityLevel level,
::aidl::android::hardware::drm::Status* err);
@@ -106,8 +110,8 @@
KeyedVector toAidlKeyedVector(const std::map<std::string, std::string>& params);
std::array<uint8_t, 16> toStdArray(const std::vector<uint8_t>& vec);
- void fillRandom(const ::aidl::android::hardware::common::Ashmem& ashmem);
- ::aidl::android::hardware::common::Ashmem getDecryptMemory(size_t size, size_t index);
+ uint8_t* fillRandom(const ::aidl::android::hardware::drm::SharedBuffer& buf);
+ void getDecryptMemory(size_t size, size_t index, SharedBuffer& buf);
uint32_t decrypt(::aidl::android::hardware::drm::Mode mode, bool isSecure,
const std::array<uint8_t, 16>& keyId, uint8_t* iv,
@@ -123,7 +127,6 @@
const std::vector<uint8_t>& key);
std::shared_ptr<::aidl::android::hardware::drm::IDrmFactory> drmFactory;
- std::shared_ptr<::aidl::android::hardware::drm::ICryptoFactory> cryptoFactory;
std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin> drmPlugin;
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> cryptoPlugin;
@@ -139,16 +142,13 @@
public:
virtual void SetUp() override {
DrmHalTest::SetUp();
- const std::vector<uint8_t> kClearKeyUUID = {0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9,
- 0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E};
+ auto kClearKeyUUID = toAidlUuid({0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9,
+ 0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E});
static const std::string kMimeType = "video/mp4";
static constexpr ::aidl::android::hardware::drm::SecurityLevel kSecurityLevel =
::aidl::android::hardware::drm::SecurityLevel::SW_SECURE_CRYPTO;
- bool drmClearkey = false;
- auto ret = drmFactory->isCryptoSchemeSupported(toAidlUuid(kClearKeyUUID), kMimeType,
- kSecurityLevel, &drmClearkey);
- if (!drmClearkey) {
+ if (!isCryptoSchemeSupported(kClearKeyUUID, kSecurityLevel, kMimeType)) {
GTEST_SKIP() << "ClearKey not supported by " << GetParamService();
}
}
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index af1dd5c..7855b51 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -53,16 +53,26 @@
ALOGE("%s: Null callback ignored", __func__);
return ScopedAStatus::fromExceptionCode(STATUS_INVALID_OPERATION);
}
-
sGnssCallback = callback;
- int capabilities = (int)(IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST |
- IGnssCallback::CAPABILITY_SATELLITE_PVT |
- IGnssCallback::CAPABILITY_CORRELATION_VECTOR);
-
+ int capabilities =
+ (int)(IGnssCallback::CAPABILITY_MEASUREMENTS | IGnssCallback::CAPABILITY_SCHEDULING |
+ IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST |
+ IGnssCallback::CAPABILITY_SATELLITE_PVT |
+ IGnssCallback::CAPABILITY_CORRELATION_VECTOR |
+ IGnssCallback::CAPABILITY_ANTENNA_INFO);
auto status = sGnssCallback->gnssSetCapabilitiesCb(capabilities);
if (!status.isOk()) {
- ALOGE("%s: Unable to invoke callback.gnssSetCapabilities", __func__);
+ ALOGE("%s: Unable to invoke callback.gnssSetCapabilitiesCb", __func__);
+ }
+
+ IGnssCallback::GnssSystemInfo systemInfo = {
+ .yearOfHw = 2022,
+ .name = "Google Mock GNSS Implementation AIDL v2",
+ };
+ status = sGnssCallback->gnssSetSystemInfoCb(systemInfo);
+ if (!status.isOk()) {
+ ALOGE("%s: Unable to invoke callback.gnssSetSystemInfoCb", __func__);
}
return ScopedAStatus::ok();
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index c1128ba..f184f81 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -33,7 +33,7 @@
ASSERT_NE(aidl_gnss_hal_, nullptr);
ALOGD("AIDL Interface Version = %d", aidl_gnss_hal_->getInterfaceVersion());
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
const auto& hidlInstanceNames = android::hardware::getAllHalInstanceNames(
android::hardware::gnss::V2_1::IGnss::descriptor);
gnss_hal_ = IGnss_V2_1::getService(hidlInstanceNames[0]);
@@ -60,9 +60,15 @@
TIMEOUT_SEC));
EXPECT_EQ(aidl_gnss_cb_->capabilities_cbq_.calledCount(), 1);
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
GnssHalTestTemplate<IGnss_V2_1>::SetUpGnssCallback();
+ } else {
+ /*
+ * SystemInfo callback should trigger
+ */
+ EXPECT_TRUE(aidl_gnss_cb_->info_cbq_.retrieve(aidl_gnss_cb_->last_info_, TIMEOUT_SEC));
+ EXPECT_EQ(aidl_gnss_cb_->info_cbq_.calledCount(), 1);
}
}
@@ -71,7 +77,7 @@
}
void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::SetPositionMode(min_interval_msec, low_power_mode);
}
@@ -93,7 +99,7 @@
bool GnssHalTest::StartAndCheckFirstLocation(const int min_interval_msec,
const bool low_power_mode) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StartAndCheckFirstLocation(min_interval_msec,
low_power_mode);
@@ -127,7 +133,7 @@
void GnssHalTest::StopAndClearLocations() {
ALOGD("StopAndClearLocations");
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StopAndClearLocations();
}
@@ -148,7 +154,7 @@
}
void GnssHalTest::StartAndCheckLocations(int count) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StartAndCheckLocations(count);
}
@@ -264,7 +270,7 @@
GnssConstellationType GnssHalTest::startLocationAndGetNonGpsConstellation(
const int locations_to_await, const int gnss_sv_info_list_timeout) {
- if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return static_cast<GnssConstellationType>(
GnssHalTestTemplate<IGnss_V2_1>::startLocationAndGetNonGpsConstellation(
locations_to_await, gnss_sv_info_list_timeout));
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 8e51b44..365f9d3 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -28,6 +28,7 @@
#include <android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.h>
#include <android/hardware/gnss/visibility_control/IGnssVisibilityControl.h>
#include <cutils/properties.h>
+#include <cmath>
#include "AGnssCallbackAidl.h"
#include "AGnssRilCallbackAidl.h"
#include "GnssAntennaInfoCallbackAidl.h"
@@ -45,7 +46,9 @@
using android::hardware::gnss::BlocklistedSource;
using android::hardware::gnss::ElapsedRealtime;
using android::hardware::gnss::GnssClock;
+using android::hardware::gnss::GnssConstellationType;
using android::hardware::gnss::GnssData;
+using android::hardware::gnss::GnssLocation;
using android::hardware::gnss::GnssMeasurement;
using android::hardware::gnss::GnssPowerStats;
using android::hardware::gnss::IAGnss;
@@ -72,7 +75,6 @@
using android::hardware::gnss::visibility_control::IGnssVisibilityControl;
using GnssConstellationTypeV2_0 = android::hardware::gnss::V2_0::GnssConstellationType;
-using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
static bool IsAutomotiveDevice() {
char buffer[PROPERTY_VALUE_MAX] = {0};
@@ -89,6 +91,222 @@
TEST_P(GnssHalTest, SetupTeardownCreateCleanup) {}
/*
+ * GetLocation:
+ * Turns on location, waits 75 second for at least 5 locations,
+ * and checks them for reasonable validity.
+ */
+TEST_P(GnssHalTest, GetLocations) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ const int kMinIntervalMsec = 500;
+ const int kLocationsToCheck = 5;
+
+ SetPositionMode(kMinIntervalMsec, /* low_power_mode= */ false);
+ StartAndCheckLocations(kLocationsToCheck);
+ StopAndClearLocations();
+}
+
+/*
+ * InjectDelete:
+ * Ensures that calls to inject and/or delete information state are handled.
+ */
+TEST_P(GnssHalTest, InjectDelete) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ // Confidently, well north of Alaska
+ auto status = aidl_gnss_hal_->injectLocation(Utils::getMockLocation(80.0, -170.0, 150.0));
+ ASSERT_TRUE(status.isOk());
+
+ // Fake time, but generally reasonable values (time in Aug. 2018)
+ status =
+ aidl_gnss_hal_->injectTime(/* timeMs= */ 1534567890123L,
+ /* timeReferenceMs= */ 123456L, /* uncertaintyMs= */ 10000L);
+ ASSERT_TRUE(status.isOk());
+
+ status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION);
+ ASSERT_TRUE(status.isOk());
+
+ status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::TIME);
+ ASSERT_TRUE(status.isOk());
+
+ // Ensure we can get a good location after a bad injection has been deleted
+ StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false);
+ StopAndClearLocations();
+}
+
+/*
+ * InjectSeedLocation:
+ * Injects a seed location and ensures the injected seed location is not fused in the resulting
+ * GNSS location.
+ */
+TEST_P(GnssHalTest, InjectSeedLocation) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ // An arbitrary position in North Pacific Ocean (where no VTS labs will ever likely be located).
+ const double seedLatDegrees = 32.312894;
+ const double seedLngDegrees = -172.954117;
+ const float seedAccuracyMeters = 150.0;
+
+ auto status = aidl_gnss_hal_->injectLocation(
+ Utils::getMockLocation(seedLatDegrees, seedLngDegrees, seedAccuracyMeters));
+ ASSERT_TRUE(status.isOk());
+
+ StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false);
+
+ // Ensure we don't get a location anywhere within 111km (1 degree of lat or lng) of the seed
+ // location.
+ EXPECT_TRUE(std::abs(aidl_gnss_cb_->last_location_.latitudeDegrees - seedLatDegrees) > 1.0 ||
+ std::abs(aidl_gnss_cb_->last_location_.longitudeDegrees - seedLngDegrees) > 1.0);
+
+ StopAndClearLocations();
+
+ status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION);
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
+ * GnssCapabilities:
+ * 1. Verifies that GNSS hardware supports measurement capabilities.
+ * 2. Verifies that GNSS hardware supports Scheduling capabilities.
+ */
+TEST_P(GnssHalTest, GnssCapabilites) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ if (!IsAutomotiveDevice()) {
+ EXPECT_TRUE(aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_MEASUREMENTS);
+ }
+ EXPECT_TRUE(aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_SCHEDULING);
+}
+
+/*
+ * GetLocationLowPower:
+ * Turns on location, waits for at least 5 locations allowing max of LOCATION_TIMEOUT_SUBSEQUENT_SEC
+ * between one location and the next. Also ensure that MIN_INTERVAL_MSEC is respected by waiting
+ * NO_LOCATION_PERIOD_SEC and verfiy that no location is received. Also perform validity checks on
+ * each received location.
+ */
+TEST_P(GnssHalTest, GetLocationLowPower) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+
+ const int kMinIntervalMsec = 5000;
+ const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2;
+ const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2;
+ const int kLocationsToCheck = 5;
+ const bool kLowPowerMode = true;
+
+ // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider
+ aidl_gnss_cb_->location_cbq_.reset();
+ StartAndCheckLocations(kLocationsToCheck);
+ StopAndClearLocations();
+ aidl_gnss_cb_->location_cbq_.reset();
+
+ // Start of Low Power Mode test
+ // Don't expect true - as without AGPS access
+ if (!StartAndCheckFirstLocation(kMinIntervalMsec, kLowPowerMode)) {
+ ALOGW("GetLocationLowPower test - no first low power location received.");
+ }
+
+ for (int i = 1; i < kLocationsToCheck; i++) {
+ // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and
+ // ensure that no location is received yet
+
+ aidl_gnss_cb_->location_cbq_.retrieve(aidl_gnss_cb_->last_location_, kNoLocationPeriodSec);
+ const int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount();
+ // Tolerate (ignore) one extra location right after the first one
+ // to handle startup edge case scheduling limitations in some implementations
+ if ((i == 1) && (location_called_count == 2)) {
+ CheckLocation(aidl_gnss_cb_->last_location_, true);
+ continue; // restart the quiet wait period after this too-fast location
+ }
+ EXPECT_LE(location_called_count, i);
+ if (location_called_count != i) {
+ ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ",
+ location_called_count, i);
+ }
+
+ if (!aidl_gnss_cb_->location_cbq_.retrieve(
+ aidl_gnss_cb_->last_location_,
+ kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) {
+ ALOGW("GetLocationLowPower test - timeout awaiting location %d", i);
+ } else {
+ CheckLocation(aidl_gnss_cb_->last_location_, true);
+ }
+ }
+
+ StopAndClearLocations();
+}
+
+/*
+ * InjectBestLocation
+ *
+ * Ensure successfully injecting a location.
+ */
+TEST_P(GnssHalTest, InjectBestLocation) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ StartAndCheckLocations(1);
+ GnssLocation gnssLocation = aidl_gnss_cb_->last_location_;
+ CheckLocation(gnssLocation, true);
+
+ auto status = aidl_gnss_hal_->injectBestLocation(gnssLocation);
+
+ ASSERT_TRUE(status.isOk());
+
+ status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION);
+
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
+ * TestGnssSvInfoFields:
+ * Gets 1 location and a (non-empty) GnssSvInfo, and verifies basebandCN0DbHz is valid.
+ */
+TEST_P(GnssHalTest, TestGnssSvInfoFields) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ aidl_gnss_cb_->location_cbq_.reset();
+ aidl_gnss_cb_->sv_info_list_cbq_.reset();
+ StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false);
+ int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount();
+ ALOGD("Observed %d GnssSvStatus, while awaiting one location (%d received)",
+ aidl_gnss_cb_->sv_info_list_cbq_.size(), location_called_count);
+
+ // Wait for up to kNumSvInfoLists events for kTimeoutSeconds for each event.
+ int kTimeoutSeconds = 2;
+ int kNumSvInfoLists = 4;
+ std::list<std::vector<IGnssCallback::GnssSvInfo>> sv_info_lists;
+ std::vector<IGnssCallback::GnssSvInfo> last_sv_info_list;
+
+ do {
+ EXPECT_GT(aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_lists, kNumSvInfoLists,
+ kTimeoutSeconds),
+ 0);
+ last_sv_info_list = sv_info_lists.back();
+ } while (last_sv_info_list.size() == 0);
+
+ ALOGD("last_sv_info size = %d", (int)last_sv_info_list.size());
+ bool nonZeroCn0Found = false;
+ for (auto sv_info : last_sv_info_list) {
+ EXPECT_TRUE(sv_info.basebandCN0DbHz >= 0.0 && sv_info.basebandCN0DbHz <= 65.0);
+ if (sv_info.basebandCN0DbHz > 0.0) {
+ nonZeroCn0Found = true;
+ }
+ }
+ // Assert at least one value is non-zero. Zero is ok in status as it's possibly
+ // reporting a searched but not found satellite.
+ EXPECT_TRUE(nonZeroCn0Found);
+ StopAndClearLocations();
+}
+
+/*
* TestPsdsExtension:
* 1. Gets the PsdsExtension
* 2. Injects empty PSDS data and verifies that it returns an error.
@@ -158,15 +376,7 @@
}
void CheckGnssMeasurementClockFields(const GnssData& measurement) {
- ASSERT_TRUE(measurement.elapsedRealtime.flags >= 0 &&
- measurement.elapsedRealtime.flags <= (ElapsedRealtime::HAS_TIMESTAMP_NS |
- ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS));
- if (measurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) {
- ASSERT_TRUE(measurement.elapsedRealtime.timestampNs > 0);
- }
- if (measurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) {
- ASSERT_TRUE(measurement.elapsedRealtime.timeUncertaintyNs > 0);
- }
+ Utils::checkElapsedRealtime(measurement.elapsedRealtime);
ASSERT_TRUE(measurement.clock.gnssClockFlags >= 0 &&
measurement.clock.gnssClockFlags <=
(GnssClock::HAS_LEAP_SECOND | GnssClock::HAS_TIME_UNCERTAINTY |
@@ -189,6 +399,34 @@
GnssMeasurement::HAS_CORRELATION_VECTOR));
}
+void CheckGnssMeasurementFields(const GnssMeasurement& measurement, const GnssData& data) {
+ CheckGnssMeasurementFlags(measurement);
+ // Verify CodeType is valid.
+ ASSERT_NE(measurement.signalType.codeType, "");
+ // Verify basebandCn0DbHz is valid.
+ ASSERT_TRUE(measurement.basebandCN0DbHz > 0.0 && measurement.basebandCN0DbHz <= 65.0);
+
+ if (((measurement.flags & GnssMeasurement::HAS_FULL_ISB) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY) > 0)) {
+ GnssConstellationType referenceConstellation =
+ data.clock.referenceSignalTypeForIsb.constellation;
+ double carrierFrequencyHz = data.clock.referenceSignalTypeForIsb.carrierFrequencyHz;
+ std::string codeType = data.clock.referenceSignalTypeForIsb.codeType;
+
+ ASSERT_TRUE(referenceConstellation >= GnssConstellationType::UNKNOWN &&
+ referenceConstellation <= GnssConstellationType::IRNSS);
+ ASSERT_TRUE(carrierFrequencyHz > 0);
+ ASSERT_NE(codeType, "");
+
+ ASSERT_TRUE(std::abs(measurement.fullInterSignalBiasNs) < 1.0e6);
+ ASSERT_TRUE(measurement.fullInterSignalBiasUncertaintyNs >= 0);
+ ASSERT_TRUE(std::abs(measurement.satelliteInterSignalBiasNs) < 1.0e6);
+ ASSERT_TRUE(measurement.satelliteInterSignalBiasUncertaintyNs >= 0);
+ }
+}
+
/*
* TestGnssMeasurementExtensionAndSatellitePvt:
* 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension.
@@ -229,7 +467,7 @@
CheckGnssMeasurementClockFields(lastMeasurement);
for (const auto& measurement : lastMeasurement.measurements) {
- CheckGnssMeasurementFlags(measurement);
+ CheckGnssMeasurementFields(measurement, lastMeasurement);
if (measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT &&
kIsSatellitePvtSupported == true) {
ALOGD("Found a measurement with SatellitePvt");
@@ -289,7 +527,7 @@
CheckGnssMeasurementClockFields(lastMeasurement);
for (const auto& measurement : lastMeasurement.measurements) {
- CheckGnssMeasurementFlags(measurement);
+ CheckGnssMeasurementFields(measurement, lastMeasurement);
if (measurement.flags & GnssMeasurement::HAS_CORRELATION_VECTOR) {
correlationVectorFound = true;
ASSERT_TRUE(measurement.correlationVectors.size() > 0);
@@ -466,7 +704,7 @@
FindStrongFrequentNonGpsSource(sv_info_vec_list, kLocationsToAwait - 1);
}
- if (source_to_blocklist.constellation == GnssConstellationTypeAidl::UNKNOWN) {
+ if (source_to_blocklist.constellation == GnssConstellationType::UNKNOWN) {
// Cannot find a non-GPS satellite. Let the test pass.
ALOGD("Cannot find a non-GPS satellite. Letting the test pass.");
return;
@@ -522,7 +760,7 @@
auto& gnss_sv = sv_info_vec[iSv];
EXPECT_FALSE(
(gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) &&
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
}
@@ -584,7 +822,7 @@
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
auto& gnss_sv = sv_info_vec[iSv];
if ((gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) &&
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)) {
strongest_sv_is_reobserved = true;
@@ -633,7 +871,7 @@
const int kGnssSvInfoListTimeout = 2;
// Find first non-GPS constellation to blocklist
- GnssConstellationTypeAidl constellation_to_blocklist = static_cast<GnssConstellationTypeAidl>(
+ GnssConstellationType constellation_to_blocklist = static_cast<GnssConstellationType>(
startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
// Turns off location
@@ -646,7 +884,7 @@
// IRNSS was added in 2.0. Always attempt to blocklist IRNSS to verify that the new enum is
// supported.
BlocklistedSource source_to_blocklist_2;
- source_to_blocklist_2.constellation = GnssConstellationTypeAidl::IRNSS;
+ source_to_blocklist_2.constellation = GnssConstellationType::IRNSS;
source_to_blocklist_2.svid = 0; // documented wildcard for all satellites in this constellation
sp<IGnssConfiguration> gnss_configuration_hal;
@@ -686,11 +924,11 @@
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
const auto& gnss_sv = sv_info_vec[iSv];
EXPECT_FALSE(
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist_1.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
EXPECT_FALSE(
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist_2.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
}
@@ -736,7 +974,7 @@
const int kGnssSvInfoListTimeout = 2;
// Find first non-GPS constellation to blocklist
- GnssConstellationTypeAidl constellation_to_blocklist = static_cast<GnssConstellationTypeAidl>(
+ GnssConstellationType constellation_to_blocklist = static_cast<GnssConstellationType>(
startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
BlocklistedSource source_to_blocklist_1;
@@ -746,7 +984,7 @@
// IRNSS was added in 2.0. Always attempt to blocklist IRNSS to verify that the new enum is
// supported.
BlocklistedSource source_to_blocklist_2;
- source_to_blocklist_2.constellation = GnssConstellationTypeAidl::IRNSS;
+ source_to_blocklist_2.constellation = GnssConstellationType::IRNSS;
source_to_blocklist_2.svid = 0; // documented wildcard for all satellites in this constellation
sp<IGnssConfiguration> gnss_configuration_hal;
@@ -789,11 +1027,11 @@
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
const auto& gnss_sv = sv_info_vec[iSv];
EXPECT_FALSE(
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist_1.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
EXPECT_FALSE(
- (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
source_to_blocklist_2.constellation) &&
(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
}
@@ -884,7 +1122,8 @@
* TestAGnssRilExtension:
* 1. Gets the IAGnssRil extension.
* 2. Sets AGnssRilCallback.
- * 3. Sets reference location.
+ * 3. Update network state to connected and then disconnected.
+ * 4. Sets reference location.
*/
TEST_P(GnssHalTest, TestAGnssRilExtension) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
@@ -899,6 +1138,20 @@
status = iAGnssRil->setCallback(agnssRilCallback);
ASSERT_TRUE(status.isOk());
+ // Update GNSS HAL that a network has connected.
+ IAGnssRil::NetworkAttributes networkAttributes;
+ networkAttributes.networkHandle = 7700664333L;
+ networkAttributes.isConnected = true;
+ networkAttributes.capabilities = IAGnssRil::NETWORK_CAPABILITY_NOT_ROAMING;
+ networkAttributes.apn = "placeholder-apn";
+ status = iAGnssRil->updateNetworkState(networkAttributes);
+ ASSERT_TRUE(status.isOk());
+
+ // Update GNSS HAL that network has disconnected.
+ networkAttributes.isConnected = false;
+ status = iAGnssRil->updateNetworkState(networkAttributes);
+ ASSERT_TRUE(status.isOk());
+
// Set RefLocation
IAGnssRil::AGnssRefLocationCellID agnssReflocationCellId;
agnssReflocationCellId.type = IAGnssRil::AGnssRefLocationType::LTE_CELLID;
@@ -1020,6 +1273,9 @@
// Validity check GnssData fields
CheckGnssMeasurementClockFields(lastMeasurement);
+ for (const auto& measurement : lastMeasurement.measurements) {
+ CheckGnssMeasurementFields(measurement, lastMeasurement);
+ }
}
status = iGnssMeasurement->close();
@@ -1076,12 +1332,11 @@
* PhaseCenterVariationCorrections and SignalGainCorrections are optional.
*/
TEST_P(GnssHalTest, TestGnssAntennaInfo) {
- const int kAntennaInfoTimeoutSeconds = 2;
-
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
+ const int kAntennaInfoTimeoutSeconds = 2;
sp<IGnssAntennaInfo> iGnssAntennaInfo;
auto status = aidl_gnss_hal_->getExtensionGnssAntennaInfo(&iGnssAntennaInfo);
ASSERT_TRUE(status.isOk());
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index 4e6a718..a519d3a 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -217,7 +217,8 @@
.biasUncertaintyNs = 47514.989972114563,
.driftNsps = -51.757811607455452,
.driftUncertaintyNsps = 310.64968328491528,
- .hwClockDiscontinuityCount = 1};
+ .hwClockDiscontinuityCount = 1,
+ .referenceSignalTypeForIsb = signalType};
ElapsedRealtime timestamp = {
.flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS,
diff --git a/gnss/common/utils/vts/Utils.cpp b/gnss/common/utils/vts/Utils.cpp
index da4c07f..4c725a8 100644
--- a/gnss/common/utils/vts/Utils.cpp
+++ b/gnss/common/utils/vts/Utils.cpp
@@ -20,12 +20,16 @@
#include "gtest/gtest.h"
#include <cutils/properties.h>
+#include <utils/SystemClock.h>
namespace android {
namespace hardware {
namespace gnss {
namespace common {
+using android::hardware::gnss::ElapsedRealtime;
+using android::hardware::gnss::GnssLocation;
+
using namespace measurement_corrections::V1_0;
using V1_0::GnssLocationFlags;
@@ -45,6 +49,50 @@
return location.timestamp;
}
+template <>
+void Utils::checkLocationElapsedRealtime(const V1_0::GnssLocation&) {}
+
+template <>
+void Utils::checkLocationElapsedRealtime(const android::hardware::gnss::GnssLocation& location) {
+ checkElapsedRealtime(location.elapsedRealtime);
+}
+
+void Utils::checkElapsedRealtime(const ElapsedRealtime& elapsedRealtime) {
+ ASSERT_TRUE(elapsedRealtime.flags >= 0 &&
+ elapsedRealtime.flags <= (ElapsedRealtime::HAS_TIMESTAMP_NS |
+ ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS));
+ if (elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) {
+ ASSERT_TRUE(elapsedRealtime.timestampNs > 0);
+ }
+ if (elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) {
+ ASSERT_TRUE(elapsedRealtime.timeUncertaintyNs > 0);
+ }
+}
+
+const GnssLocation Utils::getMockLocation(double latitudeDegrees, double longitudeDegrees,
+ double horizontalAccuracyMeters) {
+ ElapsedRealtime elapsedRealtime;
+ elapsedRealtime.flags =
+ ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS;
+ elapsedRealtime.timestampNs = ::android::elapsedRealtimeNano();
+ elapsedRealtime.timeUncertaintyNs = 1000;
+ GnssLocation location;
+ location.gnssLocationFlags = 0xFF;
+ location.latitudeDegrees = latitudeDegrees;
+ location.longitudeDegrees = longitudeDegrees;
+ location.altitudeMeters = 500.0;
+ location.speedMetersPerSec = 0.0;
+ location.bearingDegrees = 0.0;
+ location.horizontalAccuracyMeters = horizontalAccuracyMeters;
+ location.verticalAccuracyMeters = 1000.0;
+ location.speedAccuracyMetersPerSecond = 1000.0;
+ location.bearingAccuracyDegrees = 90.0;
+ location.timestampMillis =
+ static_cast<int64_t>(kMockTimestamp + ::android::elapsedRealtimeNano() * 1e-6);
+ location.elapsedRealtime = elapsedRealtime;
+ return location;
+}
+
const MeasurementCorrections Utils::getMockMeasurementCorrections() {
ReflectingPlane reflectingPlane = {
.latitudeDegrees = 37.4220039,
diff --git a/gnss/common/utils/vts/include/Utils.h b/gnss/common/utils/vts/include/Utils.h
index 4ea6cd6..7b89078 100644
--- a/gnss/common/utils/vts/include/Utils.h
+++ b/gnss/common/utils/vts/include/Utils.h
@@ -19,11 +19,13 @@
#include <android/hardware/gnss/1.0/IGnss.h>
#include <android/hardware/gnss/2.0/IGnss.h>
+#include <android/hardware/gnss/IGnss.h>
#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrections.h>
#include <android/hardware/gnss/measurement_corrections/1.1/IMeasurementCorrections.h>
#include <android/hardware/gnss/measurement_corrections/BnMeasurementCorrectionsInterface.h>
#include <gtest/gtest.h>
+#include <type_traits>
namespace android {
namespace hardware {
@@ -32,8 +34,18 @@
struct Utils {
public:
+ static const int64_t kMockTimestamp = 1519930775453L;
+
template <class T>
static void checkLocation(const T& location, bool check_speed, bool check_more_accuracies);
+ template <class T>
+ static void checkLocationElapsedRealtime(const T& location);
+
+ static void checkElapsedRealtime(
+ const android::hardware::gnss::ElapsedRealtime& elapsedRealtime);
+
+ static const android::hardware::gnss::GnssLocation getMockLocation(
+ double latitudeDegrees, double longitudeDegrees, double horizontalAccuracyMeters);
static const measurement_corrections::V1_0::MeasurementCorrections
getMockMeasurementCorrections();
static const measurement_corrections::V1_1::MeasurementCorrections
@@ -117,6 +129,8 @@
// Check timestamp > 1.48e12 (47 years in msec - 1970->2017+)
EXPECT_GT(getLocationTimestampMillis(location), 1.48e12);
+
+ checkLocationElapsedRealtime(location);
}
} // namespace common
diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp
index 6ec4e64..40db81d 100644
--- a/graphics/allocator/2.0/Android.bp
+++ b/graphics/allocator/2.0/Android.bp
@@ -24,4 +24,9 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/allocator/3.0/Android.bp b/graphics/allocator/3.0/Android.bp
index 768baba..800632c 100644
--- a/graphics/allocator/3.0/Android.bp
+++ b/graphics/allocator/3.0/Android.bp
@@ -26,4 +26,9 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/allocator/4.0/Android.bp b/graphics/allocator/4.0/Android.bp
index 0df9b39..5c5fb37 100644
--- a/graphics/allocator/4.0/Android.bp
+++ b/graphics/allocator/4.0/Android.bp
@@ -26,4 +26,9 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/common/1.0/Android.bp b/graphics/common/1.0/Android.bp
index 74a0d9b..ac158d9 100644
--- a/graphics/common/1.0/Android.bp
+++ b/graphics/common/1.0/Android.bp
@@ -21,4 +21,9 @@
],
gen_java: true,
gen_java_constants: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/common/1.1/Android.bp b/graphics/common/1.1/Android.bp
index a120278..e45d6dd 100644
--- a/graphics/common/1.1/Android.bp
+++ b/graphics/common/1.1/Android.bp
@@ -24,4 +24,9 @@
],
gen_java: true,
gen_java_constants: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/common/1.2/Android.bp b/graphics/common/1.2/Android.bp
index fe149e4..c23085d 100644
--- a/graphics/common/1.2/Android.bp
+++ b/graphics/common/1.2/Android.bp
@@ -25,4 +25,9 @@
],
gen_java: true,
gen_java_constants: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Luminance.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/AlphaInterpretation.aidl
similarity index 88%
copy from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Luminance.aidl
copy to graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/AlphaInterpretation.aidl
index adb49a8..ea60283 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Luminance.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/AlphaInterpretation.aidl
@@ -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.
@@ -31,8 +31,10 @@
// with such a backward incompatible 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 Luminance {
- float nits;
+package android.hardware.graphics.common;
+/* @hide */
+@Backing(type="int") @VintfStability
+enum AlphaInterpretation {
+ COVERAGE = 0,
+ MASK = 1,
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/BufferAheadResult.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayDecorationSupport.aidl
similarity index 86%
rename from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/BufferAheadResult.aidl
rename to graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayDecorationSupport.aidl
index 94fd91b..27eff76 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/BufferAheadResult.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayDecorationSupport.aidl
@@ -31,14 +31,10 @@
// with such a backward incompatible 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;
+package android.hardware.graphics.common;
+/* @hide */
@VintfStability
-parcelable BufferAheadResult {
- long display;
- android.hardware.graphics.composer3.BufferAheadResult.Layer[] layers;
- @VintfStability
- parcelable Layer {
- long layer;
- boolean presented;
- }
+parcelable DisplayDecorationSupport {
+ android.hardware.graphics.common.PixelFormat format;
+ android.hardware.graphics.common.AlphaInterpretation alphaInterpretation;
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/AlphaInterpretation.aidl b/graphics/common/aidl/android/hardware/graphics/common/AlphaInterpretation.aidl
new file mode 100644
index 0000000..e994cf2
--- /dev/null
+++ b/graphics/common/aidl/android/hardware/graphics/common/AlphaInterpretation.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.graphics.common;
+
+/**
+ * How to interperet alpha values when it may be ambiguous.
+ * @hide
+ */
+@VintfStability
+@Backing(type="int")
+enum AlphaInterpretation {
+ /**
+ * Alpha values are treated as coverage.
+ *
+ * Pixels in the buffer with an alpha of 0 (transparent) will be rendered in
+ * black, and pixels with a max value will show the content underneath. An
+ * alpha in between will show the content blended with black.
+ */
+ COVERAGE = 0,
+ /**
+ * Alpha values are treated as a mask.
+ *
+ * Pixels in the buffer with an alpha of 0 (transparent) will show the
+ * content underneath, and pixels with a max value will be rendered in
+ * black. An alpha in between will show the content blended with black.
+ */
+ MASK = 1,
+}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/DisplayDecorationSupport.aidl b/graphics/common/aidl/android/hardware/graphics/common/DisplayDecorationSupport.aidl
new file mode 100644
index 0000000..42c2392
--- /dev/null
+++ b/graphics/common/aidl/android/hardware/graphics/common/DisplayDecorationSupport.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.graphics.common;
+
+import android.hardware.graphics.common.PixelFormat;
+import android.hardware.graphics.common.AlphaInterpretation;
+
+/**
+ * A description of how a device supports Composition.DISPLAY_DECORATION.
+ *
+ * If the device supports Composition.DISPLAY_DECORATION, a call to
+ * IComposerClient.getDisplayDecorationSupport should return an instance of this
+ * parcelable. Otherwise the method should return null.
+ * @hide
+ */
+@VintfStability
+parcelable DisplayDecorationSupport {
+ /**
+ * The format to use for DISPLAY_DECORATION layers. Other formats are not
+ * supported. If other formats are used with DISPLAY_DECORATION, the result
+ * is undefined.
+ */
+ PixelFormat format;
+ /**
+ * How the device intreprets the alpha in the pixel buffer.
+ */
+ AlphaInterpretation alphaInterpretation;
+}
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 e989b6c..9c49583 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
@@ -39,5 +39,4 @@
SKIP_CLIENT_COLOR_TRANSFORM = 2,
PRESENT_FENCE_IS_NOT_RELIABLE = 3,
SKIP_VALIDATE = 4,
- BUFFER_AHEAD = 5,
}
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 fb39172..ebbb31e 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
@@ -39,7 +39,6 @@
android.hardware.graphics.composer3.DisplayRequest displayRequest;
android.hardware.graphics.composer3.PresentFence presentFence;
android.hardware.graphics.composer3.ReleaseFences releaseFences;
- android.hardware.graphics.composer3.BufferAheadResult bufferAheadResult;
android.hardware.graphics.composer3.PresentOrValidate presentOrValidateResult;
android.hardware.graphics.composer3.ClientTargetPropertyWithNits clientTargetProperty;
}
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 b41ac8a..6eba887 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
@@ -41,6 +41,5 @@
PROTECTED_CONTENTS = 4,
AUTO_LOW_LATENCY_MODE = 5,
SUSPEND = 6,
- DISPLAY_DECORATION = 7,
- DISPLAY_IDLE_TIMER = 8,
+ DISPLAY_IDLE_TIMER = 7,
}
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 2de699b..b49f239 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
@@ -59,6 +59,7 @@
@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);
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Luminance.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerBrightness.aidl
similarity index 96%
rename from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Luminance.aidl
rename to graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerBrightness.aidl
index adb49a8..a726cc1 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Luminance.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerBrightness.aidl
@@ -33,6 +33,6 @@
package android.hardware.graphics.composer3;
@VintfStability
-parcelable Luminance {
- float nits;
+parcelable LayerBrightness {
+ float brightness;
}
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 1429c35..0c5fac9 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
@@ -37,7 +37,6 @@
long layer;
@nullable android.hardware.graphics.common.Point cursorPosition;
@nullable android.hardware.graphics.composer3.Buffer buffer;
- @nullable android.hardware.graphics.composer3.Buffer bufferAhead;
@nullable android.hardware.graphics.common.Rect[] damage;
@nullable android.hardware.graphics.composer3.ParcelableBlendMode blendMode;
@nullable android.hardware.graphics.composer3.Color color;
@@ -51,7 +50,7 @@
@nullable android.hardware.graphics.common.Rect[] visibleRegion;
@nullable android.hardware.graphics.composer3.ZOrder z;
@nullable float[] colorTransform;
- @nullable android.hardware.graphics.composer3.Luminance whitePointNits;
+ @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;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/BufferAheadResult.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/BufferAheadResult.aidl
deleted file mode 100644
index 7ca4578..0000000
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/BufferAheadResult.aidl
+++ /dev/null
@@ -1,46 +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 BufferAheadResult {
- /**
- * The display which this commands refers to.
- * @see IComposer.createDisplay
- */
- long display;
-
- @VintfStability
- parcelable Layer {
- /**
- * The layer which this commands refers to.
- * @see IComposer.createLayer
- */
- long layer;
-
- /**
- * Represents whether BufferAhead was presented as part of the last
- * present or not.
- */
- boolean presented;
- }
-
- /**
- * The layers which has BufferAheadResult populated.
- */
- Layer[] layers;
-}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
index 77ad1e0..ea619ae 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
@@ -57,9 +57,4 @@
* validateDisplay step is needed.
*/
SKIP_VALIDATE = 4,
- /**
- * Specifies that a device is able to use the LayerCommand.bufferAhead
- * when provided.
- */
- BUFFER_AHEAD = 5
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl
index fd1e4cc..f2de68e 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl
@@ -16,7 +16,6 @@
package android.hardware.graphics.composer3;
-import android.hardware.graphics.composer3.BufferAheadResult;
import android.hardware.graphics.composer3.ChangedCompositionTypes;
import android.hardware.graphics.composer3.ClientTargetPropertyWithNits;
import android.hardware.graphics.composer3.CommandError;
@@ -79,13 +78,6 @@
ReleaseFences releaseFences;
/**
- * Represents the result of the LayerCommand.bufferAhead that was
- * sent in the last presentDisplay call. That is, the presentDisplay
- * call prior to this presentDisplay.
- */
- BufferAheadResult bufferAheadResult;
-
- /**
* Sets the state of PRESENT_OR_VALIDATE_DISPLAY command.
*/
PresentOrValidate presentOrValidateResult;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
index 803de06..adcc9f6 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
@@ -75,13 +75,12 @@
SIDEBAND = 5,
/**
* A display decoration layer contains a buffer which is used to provide
- * anti-aliasing on the cutout region/rounded corners on the top and
+ * anti-aliasing on the cutout region and rounded corners on the top and
* bottom of a display.
*
- * Pixels in the buffer with an alpha of 0 (transparent) will show the
- * content underneath, and pixels with a max alpha value will be rendered in
- * black. An alpha in between will show the underlying content blended with
- * black.
+ * Only supported if the device returns a valid struct from
+ * getDisplayDecorationSupport. Pixels in the buffer are interpreted
+ * according to the DisplayDecorationSupport.alphInterpretation.
*
* Upon validateDisplay, the device may request a change from this type
* to either DEVICE or CLIENT.
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
index 85136c4..f4b2984 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
@@ -76,12 +76,8 @@
*/
SUSPEND = 6,
/**
- * Indicates that the display supports Composition.DISPLAY_DECORATION.
- */
- DISPLAY_DECORATION = 7,
- /**
* Indicates that the display supports IComposerClient.setIdleTimerEnabled and
* IComposerCallback.onVsyncIdle.
*/
- DISPLAY_IDLE_TIMER = 8,
+ DISPLAY_IDLE_TIMER = 7,
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
index f1ce1a7..b6df147 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
@@ -77,15 +77,7 @@
* the display brightness, for example when internally switching the display between multiple
* power modes to achieve higher luminance. In those cases, the underlying display panel's real
* brightness may not be applied atomically; however, layer dimming when mixing HDR and SDR
- * content must be synchronized.
- *
- * As an illustrative example: suppose two layers have white
- * points of 200 nits and 1000 nits respectively, the old display luminance is 200 nits, and the
- * new display luminance is 1000 nits. If the new display luminance takes two frames to apply,
- * then: In the first frame, there must not be any relative dimming of layers (treat both layers
- * as 200 nits as the maximum luminance of the display is 200 nits). In the second frame, there
- * dimming should be applied to ensure that the first layer does not become perceptually
- * brighter during the transition.
+ * content must be synchronized to ensure that there is no user-perceptable flicker.
*
* The display luminance must be updated by this command even if there is not pending validate
* or present command.
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
index 2fe6656..769f803 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -16,6 +16,7 @@
package android.hardware.graphics.composer3;
+import android.hardware.graphics.common.DisplayDecorationSupport;
import android.hardware.graphics.common.Transform;
import android.hardware.graphics.composer3.ClientTargetProperty;
import android.hardware.graphics.composer3.ColorMode;
@@ -516,6 +517,16 @@
ContentType[] getSupportedContentTypes(long display);
/**
+ * Report whether and how this display supports Composition.DISPLAY_DECORATION.
+ *
+ * @return A description of how the display supports DISPLAY_DECORATION, or null
+ * if it is unsupported.
+ *
+ * @exception EX_BAD_DISPLAY when an invalid display handle was passed in.
+ */
+ @nullable DisplayDecorationSupport getDisplayDecorationSupport(long display);
+
+ /**
* Provides a IComposerCallback object for the device to call.
*
* This function must be called only once.
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Luminance.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerBrightness.aidl
similarity index 76%
rename from graphics/composer/aidl/android/hardware/graphics/composer3/Luminance.aidl
rename to graphics/composer/aidl/android/hardware/graphics/composer3/LayerBrightness.aidl
index 5b1c1b4..146e012 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Luminance.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerBrightness.aidl
@@ -17,10 +17,10 @@
package android.hardware.graphics.composer3;
@VintfStability
-parcelable Luminance {
+parcelable LayerBrightness {
/**
- * Photometric measure of luminous intensity per unit area of light.
- * Units are nits, or cd/m^2.
+ * Brightness of the current layer, ranging from 0 to 1, where 0 is the minimum brightness of
+ * the display, and 1 is the current brightness of the display.
*/
- float nits;
+ float brightness;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl
index ab93794..f3b67a9 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl
@@ -22,7 +22,7 @@
import android.hardware.graphics.common.Rect;
import android.hardware.graphics.composer3.Buffer;
import android.hardware.graphics.composer3.Color;
-import android.hardware.graphics.composer3.Luminance;
+import android.hardware.graphics.composer3.LayerBrightness;
import android.hardware.graphics.composer3.ParcelableBlendMode;
import android.hardware.graphics.composer3.ParcelableComposition;
import android.hardware.graphics.composer3.ParcelableDataspace;
@@ -70,30 +70,6 @@
@nullable Buffer buffer;
/**
- * Sets a buffer handle to be displayed for this layer and a file descriptor
- * referring to an acquire sync fence object, which must be signaled when it is
- * safe to read from the given buffer.
- *
- * When bufferAhead is provided, the implementation should try to
- * present it on the next scanout as long as its acquire sync fence
- * is signaled by that time. Otherwise the bufferAhead should be dropped.
- * This allows the client to set an
- * unsignaled buffer on the layer without causing the entire display to miss
- * an update if the buffer is not ready by the next scanout time.
- *
- * In case bufferAhead is dropped and LayerCommand.buffer is provided, LayerCommand.buffer
- * should be used as the next layer buffer.
- *
- * The implementation is expected to populate the CommandResultPayload.bufferAheadResult
- * with information about whether bufferAhead was presented or dropped.
- * Since this information is not known at the current presentDisplay call
- * of frame N (as the scanout happens after the call returns),
- * the implementation should populate it when presentDisplay is
- * called for frame N+1.
- */
- @nullable Buffer bufferAhead;
-
- /**
* Provides the region of the source buffer which has been modified since
* the last frame. This region does not need to be validated before
* calling presentDisplay.
@@ -245,12 +221,12 @@
@nullable float[] colorTransform;
/**
- * Sets the desired white point for the layer. This is intended to be used when presenting
- * an SDR layer alongside HDR content. The HDR content will be presented at the display
- * brightness in nits, and accordingly SDR content shall be dimmed to the desired white point
- * provided.
+ * Sets the desired brightness for the layer. This is intended to be used for instance when
+ * presenting an SDR layer alongside HDR content. The HDR content will be presented at the
+ * display brightness in nits, and accordingly SDR content shall be dimmed according to the
+ * provided brightness ratio.
*/
- @nullable Luminance whitePointNits;
+ @nullable LayerBrightness brightness;
/**
* Sets the PerFrameMetadata for the display. This metadata must be used
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/Android.bp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/Android.bp
index bd2c3b1..139b5e8 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/Android.bp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/Android.bp
@@ -35,6 +35,9 @@
"VtsHalGraphicsComposer3_TargetTest.cpp",
"VtsHalGraphicsComposer3_ReadbackTest.cpp",
"composer-vts/GraphicsComposerCallback.cpp",
+ "composer-vts/ReadbackVts.cpp",
+ "composer-vts/RenderEngineVts.cpp",
+ "composer-vts/VtsComposerClient.cpp",
],
shared_libs: [
@@ -72,15 +75,19 @@
"android.hardware.graphics.allocator@2.0",
"android.hardware.graphics.allocator@3.0",
"android.hardware.graphics.allocator@4.0",
- "android.hardware.graphics.composer@3-vts",
"android.hardware.graphics.mapper@2.0-vts",
"android.hardware.graphics.mapper@2.1-vts",
"android.hardware.graphics.mapper@3.0-vts",
"android.hardware.graphics.mapper@4.0-vts",
"libaidlcommonsupport",
+ "libarect",
+ "libbase",
+ "libfmq",
"libgtest",
+ "libmath",
"librenderengine",
"libshaders",
+ "libsync",
"libtonemap",
],
cflags: [
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
index 3f1e703..686299a 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
@@ -20,14 +20,12 @@
#include <aidl/Vintf.h>
#include <aidl/android/hardware/graphics/common/BufferUsage.h>
#include <aidl/android/hardware/graphics/composer3/IComposer.h>
-#include <android/binder_manager.h>
#include <composer-vts/include/ReadbackVts.h>
#include <composer-vts/include/RenderEngineVts.h>
#include <gtest/gtest.h>
#include <ui/DisplayId.h>
#include <ui/DisplayIdentification.h>
#include <ui/GraphicBuffer.h>
-#include <ui/GraphicBufferAllocator.h>
#include <ui/PixelFormat.h>
#include <ui/Rect.h>
@@ -37,6 +35,7 @@
#include <tinyxml2.h>
#pragma clang diagnostic pop
#include "composer-vts/include/GraphicsComposerCallback.h"
+#include "composer-vts/include/VtsComposerClient.h"
namespace aidl::android::hardware::graphics::composer3::vts {
namespace {
@@ -48,40 +47,22 @@
class GraphicsCompositionTestBase : public ::testing::Test {
protected:
void SetUpBase(const std::string& name) {
- ndk::SpAIBinder binder(AServiceManager_waitForService(name.c_str()));
- ASSERT_NE(binder, nullptr);
- ASSERT_NO_FATAL_FAILURE(mComposer = IComposer::fromBinder(binder));
- ASSERT_NE(mComposer, nullptr);
- ASSERT_NO_FATAL_FAILURE(mComposer->createClient(&mComposerClient));
- mComposerCallback = ::ndk::SharedRefBase::make<GraphicsComposerCallback>();
- mComposerClient->registerCallback(mComposerCallback);
+ mComposerClient = std::make_shared<VtsComposerClient>(name);
+ ASSERT_TRUE(mComposerClient->createClient().isOk());
- // assume the first display is primary and is never removed
- mPrimaryDisplay = waitForFirstDisplay();
-
- ASSERT_NO_FATAL_FAILURE(mInvalidDisplayId = GetInvalidDisplayId());
-
- int32_t activeConfig;
- EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &activeConfig).isOk());
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(mPrimaryDisplay, activeConfig,
- DisplayAttribute::WIDTH, &mDisplayWidth)
- .isOk());
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(mPrimaryDisplay, activeConfig,
- DisplayAttribute::HEIGHT, &mDisplayHeight)
- .isOk());
+ const auto& [status, displays] = mComposerClient->getDisplays();
+ ASSERT_TRUE(status.isOk());
+ mDisplays = displays;
setTestColorModes();
// explicitly disable vsync
- EXPECT_TRUE(mComposerClient->setVsyncEnabled(mPrimaryDisplay, false).isOk());
- mComposerCallback->setVsyncAllowed(false);
+ for (const auto& display : mDisplays) {
+ EXPECT_TRUE(mComposerClient->setVsync(display.getDisplayId(), /*enable*/ false).isOk());
+ }
+ mComposerClient->setVsyncAllowed(/*isAllowed*/ false);
- // set up gralloc
- mGraphicBuffer = allocate();
-
- ASSERT_NO_FATAL_FAILURE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON));
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk());
ASSERT_NO_FATAL_FAILURE(
mTestRenderEngine = std::unique_ptr<TestRenderEngine>(new TestRenderEngine(
@@ -96,11 +77,12 @@
.build())));
::android::renderengine::DisplaySettings clientCompositionDisplay;
- clientCompositionDisplay.physicalDisplay = Rect(mDisplayWidth, mDisplayHeight);
+ clientCompositionDisplay.physicalDisplay = Rect(getDisplayWidth(), getDisplayHeight());
clientCompositionDisplay.clip = clientCompositionDisplay.physicalDisplay;
mTestRenderEngine->initGraphicBuffer(
- static_cast<uint32_t>(mDisplayWidth), static_cast<uint32_t>(mDisplayHeight), 1,
+ static_cast<uint32_t>(getDisplayWidth()), static_cast<uint32_t>(getDisplayHeight()),
+ /*layerCount*/ 1U,
static_cast<uint64_t>(
static_cast<uint64_t>(common::BufferUsage::CPU_READ_OFTEN) |
static_cast<uint64_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
@@ -109,33 +91,42 @@
}
void TearDown() override {
- ASSERT_NO_FATAL_FAILURE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF));
+ ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
+ ASSERT_TRUE(mComposerClient->tearDown());
+ mComposerClient.reset();
const auto errors = mReader.takeErrors();
ASSERT_TRUE(mReader.takeErrors().empty());
- ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
-
- if (mComposerCallback != nullptr) {
- EXPECT_EQ(0, mComposerCallback->getInvalidHotplugCount());
- EXPECT_EQ(0, mComposerCallback->getInvalidRefreshCount());
- EXPECT_EQ(0, mComposerCallback->getInvalidVsyncCount());
- }
+ ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
}
- ::android::sp<::android::GraphicBuffer> allocate() {
- const auto width = static_cast<uint32_t>(mDisplayWidth);
- const auto height = static_cast<uint32_t>(mDisplayHeight);
- const auto usage = static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
- static_cast<uint32_t>(common::BufferUsage::CPU_READ_OFTEN);
+ const VtsDisplay& getPrimaryDisplay() const { return mDisplays[0]; }
- return ::android::sp<::android::GraphicBuffer>::make(
+ int64_t getPrimaryDisplayId() const { return getPrimaryDisplay().getDisplayId(); }
+
+ int64_t getInvalidDisplayId() const { return mComposerClient->getInvalidDisplayId(); }
+
+ int32_t getDisplayWidth() const { return getPrimaryDisplay().getDisplayWidth(); }
+
+ int32_t getDisplayHeight() const { return getPrimaryDisplay().getDisplayHeight(); }
+
+ std::pair<bool, ::android::sp<::android::GraphicBuffer>> allocateBuffer(uint32_t usage) {
+ const auto width = static_cast<uint32_t>(getDisplayWidth());
+ const auto height = static_cast<uint32_t>(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 {true, graphicBuffer};
+ }
+ return {false, graphicBuffer};
}
uint64_t getStableDisplayId(int64_t display) {
- DisplayIdentification identification;
- const auto error = mComposerClient->getDisplayIdentificationData(display, &identification);
- EXPECT_TRUE(error.isOk());
+ const auto& [status, identification] =
+ mComposerClient->getDisplayIdentificationData(display);
+ EXPECT_TRUE(status.isOk());
if (const auto info = ::android::parseDisplayIdentificationData(
static_cast<uint8_t>(identification.port), identification.data)) {
@@ -203,7 +194,7 @@
}
void writeLayers(const std::vector<std::shared_ptr<TestLayer>>& layers) {
- for (auto layer : layers) {
+ for (const auto& layer : layers) {
layer->write(mWriter);
}
execute();
@@ -216,59 +207,41 @@
return;
}
- std::vector<CommandResultPayload> results;
- auto status = mComposerClient->executeCommands(commands, &results);
+ auto [status, results] = mComposerClient->executeCommands(commands);
ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription();
mReader.parse(std::move(results));
mWriter.reset();
}
- bool getHasReadbackBuffer() {
- ReadbackBufferAttributes readBackBufferAttributes;
- const auto error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay,
- &readBackBufferAttributes);
- mPixelFormat = readBackBufferAttributes.format;
- mDataspace = readBackBufferAttributes.dataspace;
- return error.isOk() && ReadbackHelper::readbackSupported(mPixelFormat, mDataspace);
+ std::pair<ScopedAStatus, bool> getHasReadbackBuffer() {
+ auto [status, readBackBufferAttributes] =
+ mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId());
+ if (status.isOk()) {
+ mPixelFormat = readBackBufferAttributes.format;
+ mDataspace = readBackBufferAttributes.dataspace;
+ return {std::move(status), ReadbackHelper::readbackSupported(mPixelFormat, mDataspace)};
+ }
+ return {std::move(status), false};
}
- std::shared_ptr<IComposer> mComposer;
- std::shared_ptr<IComposerClient> mComposerClient;
-
- std::shared_ptr<GraphicsComposerCallback> mComposerCallback;
- // the first display and is assumed never to be removed
- int64_t mPrimaryDisplay;
- int64_t mInvalidDisplayId;
- int32_t mDisplayWidth;
- int32_t mDisplayHeight;
+ std::shared_ptr<VtsComposerClient> mComposerClient;
+ std::vector<VtsDisplay> mDisplays;
+ // use the slot count usually set by SF
std::vector<ColorMode> mTestColorModes;
ComposerClientWriter mWriter;
ComposerClientReader mReader;
- ::android::sp<::android::GraphicBuffer> mGraphicBuffer;
std::unique_ptr<TestRenderEngine> mTestRenderEngine;
-
common::PixelFormat mPixelFormat;
common::Dataspace mDataspace;
static constexpr uint32_t kClientTargetSlotCount = 64;
private:
- int64_t waitForFirstDisplay() {
- while (true) {
- std::vector<int64_t> displays = mComposerCallback->getDisplays();
- if (displays.empty()) {
- usleep(5 * 1000);
- continue;
- }
- return displays[0];
- }
- }
-
void setTestColorModes() {
mTestColorModes.clear();
- std::vector<ColorMode> modes;
- EXPECT_TRUE(mComposerClient->getColorModes(mPrimaryDisplay, &modes).isOk());
+ const auto& [status, modes] = mComposerClient->getColorModes(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
for (ColorMode mode : modes) {
if (std::find(ReadbackHelper::colorModes.begin(), ReadbackHelper::colorModes.end(),
@@ -277,27 +250,6 @@
}
}
}
-
- // returns an invalid display id (one that has not been registered to a
- // display. Currently assuming that a device will never have close to
- // std::numeric_limit<uint64_t>::max() displays registered while running tests
- int64_t GetInvalidDisplayId() {
- int64_t id = std::numeric_limits<int64_t>::max();
- std::vector<int64_t> displays = mComposerCallback->getDisplays();
- while (id > 0) {
- if (std::none_of(displays.begin(), displays.end(),
- [&](const auto& display) { return id == display; })) {
- return id;
- }
- id--;
- }
-
- // Although 0 could be an invalid display, a return value of 0
- // from GetInvalidDisplayId means all other ids are in use, a condition which
- // we are assuming a device will never have
- EXPECT_NE(0, id);
- return id;
- }
};
class GraphicsCompositionTest : public GraphicsCompositionTestBase,
@@ -308,16 +260,19 @@
TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
- common::Rect coloredSquare({0, 0, mDisplayWidth, mDisplayHeight});
+ auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
+ common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()});
layer->setColor(BLUE);
layer->setDisplayFrame(coloredSquare);
layer->setZOrder(10);
@@ -325,25 +280,26 @@
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
// expected color for each pixel
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE);
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
// if hwc cannot handle and asks for composition change,
// just succeed the test
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -356,31 +312,35 @@
TEST_P(GraphicsCompositionTest, SetLayerBuffer) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, 0, mDisplayWidth, mDisplayHeight / 4}, RED);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, mDisplayHeight / 4, mDisplayWidth, mDisplayHeight / 2},
- GREEN);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight},
- BLUE);
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+ {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED);
+ ReadbackHelper::fillColorsArea(
+ expectedColors, getDisplayWidth(),
+ {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight() / 2}, GREEN);
+ ReadbackHelper::fillColorsArea(
+ expectedColors, getDisplayWidth(),
+ {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE);
auto layer = std::make_shared<TestBufferLayer>(
- mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
- mDisplayHeight, common::PixelFormat::RGBA_8888);
- layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+ mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(),
+ getDisplayHeight(), common::PixelFormat::RGBA_8888);
+ layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
layer->setZOrder(10);
layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
@@ -389,16 +349,16 @@
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -412,48 +372,51 @@
TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
- common::Rect coloredSquare({0, 0, mDisplayWidth, mDisplayHeight});
+ auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
+ common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()});
layer->setColor(BLUE);
layer->setDisplayFrame(coloredSquare);
layer->setZOrder(10);
layer->write(mWriter);
// This following buffer call should have no effect
- uint64_t usage =
- static_cast<uint64_t>(static_cast<uint64_t>(common::BufferUsage::CPU_READ_OFTEN) |
- static_cast<uint64_t>(common::BufferUsage::CPU_WRITE_OFTEN));
-
- mGraphicBuffer->reallocate(static_cast<uint32_t>(mDisplayWidth),
- static_cast<uint32_t>(mDisplayHeight), 1,
- static_cast<uint32_t>(common::PixelFormat::RGBA_8888), usage);
- mWriter.setLayerBuffer(mPrimaryDisplay, layer->getLayer(), 0, mGraphicBuffer->handle, -1);
+ const auto usage = static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
+ static_cast<uint32_t>(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);
// expected color for each pixel
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE);
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -462,111 +425,120 @@
}
TEST_P(GraphicsCompositionTest, SetReadbackBuffer) {
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight,
- mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
}
-TEST_P(GraphicsCompositionTest, SetReadbackBufferBadDisplay) {
- if (!getHasReadbackBuffer()) {
+TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadDisplay) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- ASSERT_NE(nullptr, mGraphicBuffer);
- ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck());
- aidl::android::hardware::common::NativeHandle bufferHandle =
- ::android::dupToAidl(mGraphicBuffer->handle);
+ const auto usage = static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
+ static_cast<uint32_t>(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);
- const auto error = mComposerClient->setReadbackBuffer(mInvalidDisplayId, bufferHandle, fence);
+ const auto status =
+ mComposerClient->setReadbackBuffer(getInvalidDisplayId(), bufferHandle, fence);
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsCompositionTest, SetReadbackBufferBadParameter) {
- if (!getHasReadbackBuffer()) {
+TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadParameter) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- aidl::android::hardware::common::NativeHandle bufferHandle;
- {
- ::android::sp<::android::GraphicBuffer> buffer = allocate();
- ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck());
- ::android::makeToAidl(mGraphicBuffer->handle);
- }
-
+ const native_handle_t bufferHandle{};
ndk::ScopedFileDescriptor releaseFence = ndk::ScopedFileDescriptor(-1);
- const auto error =
- mComposerClient->setReadbackBuffer(mPrimaryDisplay, bufferHandle, releaseFence);
+ const auto status =
+ mComposerClient->setReadbackBuffer(getPrimaryDisplayId(), &bufferHandle, releaseFence);
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_PARAMETER, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
}
TEST_P(GraphicsCompositionTest, GetReadbackBufferFenceInactive) {
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- ndk::ScopedFileDescriptor releaseFence;
- const auto error = mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &releaseFence);
+ const auto& [status, releaseFence] =
+ mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
- ASSERT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, status.getServiceSpecificError());
EXPECT_EQ(-1, releaseFence.get());
}
TEST_P(GraphicsCompositionTest, ClientComposition) {
- EXPECT_TRUE(mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kClientTargetSlotCount)
- .isOk());
+ EXPECT_TRUE(
+ mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kClientTargetSlotCount)
+ .isOk());
for (ColorMode mode : mTestColorModes) {
- EXPECT_TRUE(mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
.isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, 0, mDisplayWidth, mDisplayHeight / 4}, RED);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, mDisplayHeight / 4, mDisplayWidth, mDisplayHeight / 2},
- GREEN);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight},
- BLUE);
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+ {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED);
+ ReadbackHelper::fillColorsArea(
+ expectedColors, getDisplayWidth(),
+ {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight() / 2}, GREEN);
+ ReadbackHelper::fillColorsArea(
+ expectedColors, getDisplayWidth(),
+ {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE);
- auto layer = std::make_shared<TestBufferLayer>(
- mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
- mDisplayHeight, PixelFormat::RGBA_FP16);
- layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+ auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine,
+ getPrimaryDisplayId(), getDisplayWidth(),
+ getDisplayHeight(), PixelFormat::RGBA_FP16);
+ layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
layer->setZOrder(10);
layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- auto changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+ auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
if (!changedCompositionTypes.empty()) {
ASSERT_EQ(1, changedCompositionTypes.size());
ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition);
@@ -577,39 +549,38 @@
static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
static_cast<uint32_t>(common::BufferUsage::COMPOSER_CLIENT_TARGET));
Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode);
- common::Rect damage{0, 0, mDisplayWidth, mDisplayHeight};
+ common::Rect damage{0, 0, getDisplayWidth(), getDisplayHeight()};
// create client target buffer
- mGraphicBuffer->reallocate(layer->getWidth(), layer->getHeight(),
- static_cast<int32_t>(common::PixelFormat::RGBA_8888),
- layer->getLayerCount(), clientUsage);
-
- ASSERT_NE(nullptr, mGraphicBuffer->handle);
-
+ const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(clientUsage);
+ ASSERT_TRUE(graphicBufferStatus);
+ const auto& buffer = graphicBuffer->handle;
void* clientBufData;
- mGraphicBuffer->lock(clientUsage, layer->getAccessRegion(), &clientBufData);
+ const auto stride = static_cast<uint32_t>(graphicBuffer->stride);
+ graphicBuffer->lock(clientUsage, layer->getAccessRegion(), &clientBufData);
ASSERT_NO_FATAL_FAILURE(
- ReadbackHelper::fillBuffer(layer->getWidth(), layer->getHeight(),
- static_cast<uint32_t>(mGraphicBuffer->stride),
+ ReadbackHelper::fillBuffer(layer->getWidth(), layer->getHeight(), stride,
clientBufData, clientFormat, expectedColors));
- EXPECT_EQ(::android::OK, mGraphicBuffer->unlock());
+ int32_t clientFence;
+ const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence);
+ ASSERT_EQ(::android::OK, unlockStatus);
+ if (clientFence >= 0) {
+ sync_wait(clientFence, -1);
+ close(clientFence);
+ }
- ndk::ScopedFileDescriptor fenceHandle;
- EXPECT_TRUE(
- mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fenceHandle).isOk());
-
- layer->setToClientComposition(mWriter);
- mWriter.acceptDisplayChanges(mPrimaryDisplay);
- mWriter.setClientTarget(mPrimaryDisplay, 0, mGraphicBuffer->handle, fenceHandle.get(),
+ mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence,
clientDataspace, std::vector<common::Rect>(1, damage));
+ layer->setToClientComposition(mWriter);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+ changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
ASSERT_TRUE(changedCompositionTypes.empty());
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -619,31 +590,37 @@
}
TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kClientTargetSlotCount));
+ ASSERT_TRUE(
+ mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kClientTargetSlotCount)
+ .isOk());
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, 0, mDisplayWidth, mDisplayHeight / 2}, GREEN);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}, RED);
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+ {0, 0, getDisplayWidth(), getDisplayHeight() / 2}, GREEN);
+ ReadbackHelper::fillColorsArea(
+ expectedColors, getDisplayWidth(),
+ {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, RED);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
auto deviceLayer = std::make_shared<TestBufferLayer>(
- mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
- mDisplayHeight / 2, PixelFormat::RGBA_8888);
+ mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(),
+ getDisplayHeight() / 2, PixelFormat::RGBA_8888);
std::vector<Color> deviceColors(deviceLayer->getWidth() * deviceLayer->getHeight());
ReadbackHelper::fillColorsArea(deviceColors, static_cast<int32_t>(deviceLayer->getWidth()),
{0, 0, static_cast<int32_t>(deviceLayer->getWidth()),
@@ -662,54 +639,58 @@
static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
static_cast<uint32_t>(common::BufferUsage::COMPOSER_CLIENT_TARGET));
Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode);
- int32_t clientWidth = mDisplayWidth;
- int32_t clientHeight = mDisplayHeight / 2;
+ int32_t clientWidth = getDisplayWidth();
+ int32_t clientHeight = getDisplayHeight() / 2;
auto clientLayer = std::make_shared<TestBufferLayer>(
- mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, clientWidth,
+ mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), clientWidth,
clientHeight, PixelFormat::RGBA_FP16, Composition::DEVICE);
- common::Rect clientFrame = {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight};
+ common::Rect clientFrame = {0, getDisplayHeight() / 2, getDisplayWidth(),
+ getDisplayHeight()};
clientLayer->setDisplayFrame(clientFrame);
clientLayer->setZOrder(0);
clientLayer->write(mWriter);
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- auto changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+ auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
if (changedCompositionTypes.size() != 1) {
continue;
}
// create client target buffer
ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition);
- mGraphicBuffer->reallocate(static_cast<uint32_t>(mDisplayWidth),
- static_cast<uint32_t>(mDisplayHeight),
- static_cast<int32_t>(common::PixelFormat::RGBA_8888),
- clientLayer->getLayerCount(), clientUsage);
- ASSERT_NE(nullptr, mGraphicBuffer->handle);
+ const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(clientUsage);
+ ASSERT_TRUE(graphicBufferStatus);
+ const auto& buffer = graphicBuffer->handle;
void* clientBufData;
- mGraphicBuffer->lock(clientUsage, {0, 0, mDisplayWidth, mDisplayHeight}, &clientBufData);
+ graphicBuffer->lock(clientUsage, {0, 0, getDisplayWidth(), getDisplayHeight()},
+ &clientBufData);
- std::vector<Color> clientColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(clientColors, mDisplayWidth, clientFrame, RED);
+ std::vector<Color> clientColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(clientColors, getDisplayWidth(), clientFrame, RED);
ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(
- static_cast<uint32_t>(mDisplayWidth), static_cast<uint32_t>(mDisplayHeight),
- mGraphicBuffer->getStride(), clientBufData, clientFormat, clientColors));
- EXPECT_EQ(::android::OK, mGraphicBuffer->unlock());
+ static_cast<uint32_t>(getDisplayWidth()), static_cast<uint32_t>(getDisplayHeight()),
+ graphicBuffer->getStride(), clientBufData, clientFormat, clientColors));
+ int32_t clientFence;
+ const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence);
+ ASSERT_EQ(::android::OK, unlockStatus);
+ if (clientFence >= 0) {
+ sync_wait(clientFence, -1);
+ close(clientFence);
+ }
- ndk::ScopedFileDescriptor fenceHandle;
- EXPECT_TRUE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fenceHandle).isOk());
-
- clientLayer->setToClientComposition(mWriter);
- mWriter.acceptDisplayChanges(mPrimaryDisplay);
- mWriter.setClientTarget(mPrimaryDisplay, 0, mGraphicBuffer->handle, fenceHandle.get(),
+ mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence,
clientDataspace, std::vector<common::Rect>(1, clientFrame));
+ clientLayer->setToClientComposition(mWriter);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+ changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
ASSERT_TRUE(changedCompositionTypes.empty());
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -718,66 +699,72 @@
TEST_P(GraphicsCompositionTest, SetLayerDamage) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- common::Rect redRect = {0, 0, mDisplayWidth / 4, mDisplayHeight / 4};
+ common::Rect redRect = {0, 0, getDisplayWidth() / 4, getDisplayHeight() / 4};
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
- auto layer = std::make_shared<TestBufferLayer>(
- mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
- mDisplayHeight, PixelFormat::RGBA_8888);
- layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+ auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine,
+ getPrimaryDisplayId(), getDisplayWidth(),
+ getDisplayHeight(), PixelFormat::RGBA_8888);
+ layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
layer->setZOrder(10);
layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
// update surface damage and recheck
- redRect = {mDisplayWidth / 4, mDisplayHeight / 4, mDisplayWidth / 2, mDisplayHeight / 2};
- ReadbackHelper::clearColors(expectedColors, mDisplayWidth, mDisplayHeight, mDisplayWidth);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
+ redRect = {getDisplayWidth() / 4, getDisplayHeight() / 4, getDisplayWidth() / 2,
+ getDisplayHeight() / 2};
+ ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(),
+ getDisplayWidth());
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
ASSERT_NO_FATAL_FAILURE(layer->fillBuffer(expectedColors));
layer->setSurfaceDamage(
- std::vector<common::Rect>(1, {0, 0, mDisplayWidth / 2, mDisplayWidth / 2}));
+ std::vector<common::Rect>(1, {0, 0, getDisplayWidth() / 2, getDisplayWidth() / 2}));
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -787,43 +774,47 @@
TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+ auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
layer->setColor(RED);
- layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+ layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
layer->setZOrder(10);
layer->setAlpha(0);
layer->setBlendMode(BlendMode::PREMULTIPLIED);
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
mTestRenderEngine->setRenderLayers(layers);
@@ -834,50 +825,54 @@
TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, 0, mDisplayWidth, mDisplayHeight / 4}, RED);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight},
- BLUE);
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+ {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED);
+ ReadbackHelper::fillColorsArea(
+ expectedColors, getDisplayWidth(),
+ {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE);
- auto layer = std::make_shared<TestBufferLayer>(
- mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
- mDisplayHeight, PixelFormat::RGBA_8888);
- layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+ auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine,
+ getPrimaryDisplayId(), getDisplayWidth(),
+ getDisplayHeight(), PixelFormat::RGBA_8888);
+ layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
layer->setZOrder(10);
layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
- layer->setSourceCrop({0, static_cast<float>(mDisplayHeight / 2),
- static_cast<float>(mDisplayWidth),
- static_cast<float>(mDisplayHeight)});
+ layer->setSourceCrop({0, static_cast<float>(getDisplayHeight() / 2),
+ static_cast<float>(getDisplayWidth()),
+ static_cast<float>(getDisplayHeight())});
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
// update expected colors to match crop
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
- {0, 0, mDisplayWidth, mDisplayHeight}, BLUE);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+ {0, 0, getDisplayWidth(), getDisplayHeight()}, BLUE);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -889,67 +884,72 @@
TEST_P(GraphicsCompositionTest, SetLayerZOrder) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- common::Rect redRect = {0, 0, mDisplayWidth, mDisplayHeight / 2};
- common::Rect blueRect = {0, mDisplayHeight / 4, mDisplayWidth, mDisplayHeight};
- auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+ common::Rect redRect = {0, 0, getDisplayWidth(), getDisplayHeight() / 2};
+ common::Rect blueRect = {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight()};
+ auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
redLayer->setColor(RED);
redLayer->setDisplayFrame(redRect);
- auto blueLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+ auto blueLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
blueLayer->setColor(BLUE);
blueLayer->setDisplayFrame(blueRect);
blueLayer->setZOrder(5);
std::vector<std::shared_ptr<TestLayer>> layers = {redLayer, blueLayer};
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
// red in front of blue
redLayer->setZOrder(10);
// fill blue first so that red will overwrite on overlap
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, blueRect, BLUE);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), blueRect, BLUE);
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
redLayer->setZOrder(1);
- ReadbackHelper::clearColors(expectedColors, mDisplayWidth, mDisplayHeight, mDisplayWidth);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, blueRect, BLUE);
+ ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(),
+ getDisplayWidth());
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), blueRect, BLUE);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
+ ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -960,10 +960,10 @@
}
}
-TEST_P(GraphicsCompositionTest, SetLayerWhitePointDims) {
- std::vector<DisplayCapability> capabilities;
- const auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
- ASSERT_TRUE(error.isOk());
+TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) {
+ const auto& [status, capabilities] =
+ mComposerClient->getDisplayCapabilities(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
const bool brightnessSupport = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::BRIGHTNESS) != capabilities.end();
@@ -974,7 +974,7 @@
}
const std::optional<float> maxBrightnessNitsOptional =
- getMaxDisplayBrightnessNits(mPrimaryDisplay);
+ getMaxDisplayBrightnessNits(getPrimaryDisplayId());
ASSERT_TRUE(maxBrightnessNitsOptional.has_value());
@@ -983,57 +983,65 @@
// Preconditions to successfully run are knowing the max brightness and successfully applying
// the max brightness
ASSERT_GT(maxBrightnessNits, 0.f);
- mWriter.setDisplayBrightness(mPrimaryDisplay, 1.f);
+ mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.f);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace for "
"color mode: "
<< toString(mode);
continue;
}
- const common::Rect redRect = {0, 0, mDisplayWidth, mDisplayHeight / 2};
- const common::Rect dimmerRedRect = {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight};
- const auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+ const common::Rect redRect = {0, 0, getDisplayWidth(), getDisplayHeight() / 2};
+ const common::Rect dimmerRedRect = {0, getDisplayHeight() / 2, getDisplayWidth(),
+ getDisplayHeight()};
+ const auto redLayer =
+ std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
redLayer->setColor(RED);
redLayer->setDisplayFrame(redRect);
redLayer->setWhitePointNits(maxBrightnessNits);
+ redLayer->setBrightness(1.f);
const auto dimmerRedLayer =
- std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+ std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
dimmerRedLayer->setColor(RED);
dimmerRedLayer->setDisplayFrame(dimmerRedRect);
// Intentionally use a small dimming ratio as some implementations may be more likely to
// kick into GPU composition to apply dithering when the dimming ratio is high.
static constexpr float kDimmingRatio = 0.9f;
dimmerRedLayer->setWhitePointNits(maxBrightnessNits * kDimmingRatio);
+ dimmerRedLayer->setBrightness(kDimmingRatio);
const std::vector<std::shared_ptr<TestLayer>> layers = {redLayer, dimmerRedLayer};
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, dimmerRedRect, DIM_RED);
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), dimmerRedRect, DIM_RED);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED()
<< "Readback verification not supported for GPU composition for color mode: "
<< toString(mode);
continue;
}
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -1060,19 +1068,22 @@
void setUpLayers(BlendMode blendMode) {
mLayers.clear();
- std::vector<Color> topLayerPixelColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(topLayerPixelColors, mDisplayWidth,
- {0, 0, mDisplayWidth, mDisplayHeight}, mTopLayerColor);
+ std::vector<Color> topLayerPixelColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(topLayerPixelColors, getDisplayWidth(),
+ {0, 0, getDisplayWidth(), getDisplayHeight()},
+ mTopLayerColor);
- auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
- backgroundLayer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+ auto backgroundLayer =
+ std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
+ backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
backgroundLayer->setZOrder(0);
backgroundLayer->setColor(mBackgroundColor);
- auto layer = std::make_shared<TestBufferLayer>(
- mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
- mDisplayHeight, PixelFormat::RGBA_8888);
- layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+ auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine,
+ getPrimaryDisplayId(), getDisplayWidth(),
+ getDisplayHeight(), PixelFormat::RGBA_8888);
+ layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
layer->setZOrder(10);
layer->setDataspace(Dataspace::UNKNOWN, mWriter);
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(topLayerPixelColors));
@@ -1086,7 +1097,8 @@
void setExpectedColors(std::vector<Color>& expectedColors) {
ASSERT_EQ(2, mLayers.size());
- ReadbackHelper::clearColors(expectedColors, mDisplayWidth, mDisplayHeight, mDisplayWidth);
+ ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(),
+ getDisplayWidth());
auto layer = mLayers[1];
BlendMode blendMode = layer->getBlendMode();
@@ -1126,34 +1138,38 @@
TEST_P(GraphicsBlendModeCompositionTest, None) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
setBackgroundColor(BLACK);
setTopLayerColor(TRANSLUCENT_RED);
setUpLayers(BlendMode::NONE);
setExpectedColors(expectedColors);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -1166,15 +1182,19 @@
TEST_P(GraphicsBlendModeCompositionTest, Coverage) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
setBackgroundColor(BLACK);
setTopLayerColor(TRANSLUCENT_RED);
@@ -1182,19 +1202,19 @@
setUpLayers(BlendMode::COVERAGE);
setExpectedColors(expectedColors);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -1203,34 +1223,38 @@
TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
setBackgroundColor(BLACK);
setTopLayerColor(TRANSLUCENT_RED);
setUpLayers(BlendMode::PREMULTIPLIED);
setExpectedColors(expectedColors);
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -1245,18 +1269,20 @@
void SetUp() override {
GraphicsCompositionTest::SetUp();
- auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+ auto backgroundLayer =
+ std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
backgroundLayer->setColor({0.0f, 0.0f, 0.0f, 0.0f});
- backgroundLayer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+ backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
backgroundLayer->setZOrder(0);
- mSideLength = mDisplayWidth < mDisplayHeight ? mDisplayWidth : mDisplayHeight;
+ mSideLength =
+ getDisplayWidth() < getDisplayHeight() ? getDisplayWidth() : getDisplayHeight();
common::Rect redRect = {0, 0, mSideLength / 2, mSideLength / 2};
common::Rect blueRect = {mSideLength / 2, mSideLength / 2, mSideLength, mSideLength};
- mLayer = std::make_shared<TestBufferLayer>(mComposerClient, mGraphicBuffer,
- *mTestRenderEngine, mPrimaryDisplay, mSideLength,
- mSideLength, PixelFormat::RGBA_8888);
+ mLayer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine,
+ getPrimaryDisplayId(), mSideLength, mSideLength,
+ PixelFormat::RGBA_8888);
mLayer->setDisplayFrame({0, 0, mSideLength, mSideLength});
mLayer->setZOrder(10);
@@ -1275,41 +1301,44 @@
TEST_P(GraphicsTransformCompositionTest, FLIP_H) {
for (ColorMode mode : mTestColorModes) {
- auto error =
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC);
- if (!error.isOk() &&
- (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED ||
- error.getServiceSpecificError() == IComposerClient::EX_BAD_PARAMETER)) {
+ auto status = mComposerClient->setColorMode(getPrimaryDisplayId(), mode,
+ RenderIntent::COLORIMETRIC);
+ if (!status.isOk() &&
+ (status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED ||
+ status.getServiceSpecificError() == IComposerClient::EX_BAD_PARAMETER)) {
SUCCEED() << "ColorMode not supported, skip test";
return;
}
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
mLayer->setTransform(Transform::FLIP_H);
mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
{mSideLength / 2, 0, mSideLength, mSideLength / 2}, RED);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
{0, mSideLength / 2, mSideLength / 2, mSideLength}, BLUE);
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -1322,36 +1351,40 @@
TEST_P(GraphicsTransformCompositionTest, FLIP_V) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
mLayer->setTransform(Transform::FLIP_V);
mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
{0, mSideLength / 2, mSideLength / 2, mSideLength}, RED);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
{mSideLength / 2, 0, mSideLength, mSideLength / 2}, BLUE);
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -1363,37 +1396,41 @@
TEST_P(GraphicsTransformCompositionTest, ROT_180) {
for (ColorMode mode : mTestColorModes) {
- ASSERT_NO_FATAL_FAILURE(
- mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+ .isOk());
- if (!getHasReadbackBuffer()) {
+ const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+ EXPECT_TRUE(readbackStatus.isOk());
+ if (!isSupported) {
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
return;
}
- ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
- mDisplayHeight, mPixelFormat, mDataspace);
+ ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+ getDisplayHeight(), mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
mLayer->setTransform(Transform::ROT_180);
mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
- std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+ std::vector<Color> expectedColors(
+ static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
{mSideLength / 2, mSideLength / 2, mSideLength, mSideLength},
RED);
- ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+ ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
{0, 0, mSideLength / 2, mSideLength / 2}, BLUE);
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED();
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
index 026a431..8d4bc11 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -1,7 +1,18 @@
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-
+/**
+ * Copyright (c) 2022, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/graphics/common/BlendMode.h>
@@ -11,7 +22,6 @@
#include <aidl/android/hardware/graphics/composer3/Composition.h>
#include <aidl/android/hardware/graphics/composer3/IComposer.h>
#include <android-base/properties.h>
-#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <android/hardware/graphics/composer3/ComposerClientReader.h>
#include <android/hardware/graphics/composer3/ComposerClientWriter.h>
@@ -22,16 +32,10 @@
#include <ui/PixelFormat.h>
#include <algorithm>
#include <numeric>
-#include <regex>
#include <string>
#include <thread>
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
#include "composer-vts/include/GraphicsComposerCallback.h"
-
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic pop // ignored "-Wconversion
+#include "composer-vts/include/VtsComposerClient.h"
#undef LOG_TAG
#define LOG_TAG "VtsHalGraphicsComposer3_TargetTest"
@@ -44,90 +48,39 @@
using ::android::GraphicBuffer;
using ::android::sp;
-class VtsDisplay {
- public:
- VtsDisplay(int64_t displayId, int32_t displayWidth, int32_t displayHeight)
- : mDisplayId(displayId), mDisplayWidth(displayWidth), mDisplayHeight(displayHeight) {}
-
- int64_t get() const { return mDisplayId; }
-
- FRect getCrop() const {
- return {0, 0, static_cast<float>(mDisplayWidth), static_cast<float>(mDisplayHeight)};
- }
-
- Rect getFrameRect() const { return {0, 0, mDisplayWidth, mDisplayHeight}; }
-
- void setDimensions(int32_t displayWidth, int32_t displayHeight) {
- mDisplayWidth = displayWidth;
- mDisplayHeight = displayHeight;
- }
-
- private:
- const int64_t mDisplayId;
- int32_t mDisplayWidth;
- int32_t mDisplayHeight;
-};
-
class GraphicsComposerAidlTest : public ::testing::TestWithParam<std::string> {
protected:
void SetUp() override {
- std::string name = GetParam();
- ndk::SpAIBinder binder(AServiceManager_waitForService(name.c_str()));
- ASSERT_NE(binder, nullptr);
- ASSERT_NO_FATAL_FAILURE(mComposer = IComposer::fromBinder(binder));
- ASSERT_NE(mComposer, nullptr);
+ mComposerClient = std::make_unique<VtsComposerClient>(GetParam());
+ ASSERT_TRUE(mComposerClient->createClient().isOk());
- ndk::ScopedAStatus status;
- ASSERT_NO_FATAL_FAILURE(status = mComposer->createClient(&mComposerClient));
+ const auto& [status, displays] = mComposerClient->getDisplays();
ASSERT_TRUE(status.isOk());
-
- mComposerCallback = ::ndk::SharedRefBase::make<GraphicsComposerCallback>();
- EXPECT_TRUE(mComposerClient->registerCallback(mComposerCallback).isOk());
-
- // assume the first displays are built-in and are never removed
- mDisplays = waitForDisplays();
- mPrimaryDisplay = mDisplays[0].get();
- ASSERT_NO_FATAL_FAILURE(mInvalidDisplayId = GetInvalidDisplayId());
-
- int32_t activeConfig;
- EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &activeConfig).isOk());
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(mPrimaryDisplay, activeConfig,
- DisplayAttribute::WIDTH, &mDisplayWidth)
- .isOk());
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(mPrimaryDisplay, activeConfig,
- DisplayAttribute::HEIGHT, &mDisplayHeight)
- .isOk());
+ mDisplays = displays;
// explicitly disable vsync
for (const auto& display : mDisplays) {
- EXPECT_TRUE(mComposerClient->setVsyncEnabled(display.get(), false).isOk());
+ EXPECT_TRUE(mComposerClient->setVsync(display.getDisplayId(), false).isOk());
}
- mComposerCallback->setVsyncAllowed(false);
+ mComposerClient->setVsyncAllowed(false);
}
void TearDown() override {
- destroyAllLayers();
- if (mComposerCallback != nullptr) {
- EXPECT_EQ(0, mComposerCallback->getInvalidHotplugCount());
- EXPECT_EQ(0, mComposerCallback->getInvalidRefreshCount());
- EXPECT_EQ(0, mComposerCallback->getInvalidVsyncCount());
- EXPECT_EQ(0, mComposerCallback->getInvalidVsyncPeriodChangeCount());
- EXPECT_EQ(0, mComposerCallback->getInvalidSeamlessPossibleCount());
- }
+ ASSERT_TRUE(mComposerClient->tearDown());
+ mComposerClient.reset();
}
- void Test_setContentTypeForDisplay(const int64_t& display,
- const std::vector<ContentType>& capabilities,
- const ContentType& contentType, const char* contentTypeStr) {
- const bool contentTypeSupport = std::find(capabilities.begin(), capabilities.end(),
- contentType) != capabilities.end();
+ void Test_setContentTypeForDisplay(int64_t display,
+ const std::vector<ContentType>& supportedContentTypes,
+ ContentType contentType, const char* contentTypeStr) {
+ const bool contentTypeSupport =
+ std::find(supportedContentTypes.begin(), supportedContentTypes.end(),
+ contentType) != supportedContentTypes.end();
if (!contentTypeSupport) {
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED,
- mComposerClient->setContentType(display, contentType)
- .getServiceSpecificError());
+ const auto& status = mComposerClient->setContentType(display, contentType);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, status.getServiceSpecificError());
GTEST_SUCCEED() << contentTypeStr << " content type is not supported on display "
<< std::to_string(display) << ", skipping test";
return;
@@ -137,209 +90,79 @@
EXPECT_TRUE(mComposerClient->setContentType(display, ContentType::NONE).isOk());
}
- void Test_setContentType(const ContentType& contentType, const char* contentTypeStr) {
+ void Test_setContentType(ContentType contentType, const char* contentTypeStr) {
for (const auto& display : mDisplays) {
- std::vector<ContentType> supportedContentTypes;
- const auto error = mComposerClient->getSupportedContentTypes(display.get(),
- &supportedContentTypes);
- EXPECT_TRUE(error.isOk());
-
- Test_setContentTypeForDisplay(display.get(), supportedContentTypes, contentType,
- contentTypeStr);
+ const auto& [status, supportedContentTypes] =
+ mComposerClient->getSupportedContentTypes(display.getDisplayId());
+ EXPECT_TRUE(status.isOk());
+ Test_setContentTypeForDisplay(display.getDisplayId(), supportedContentTypes,
+ contentType, contentTypeStr);
}
}
- int64_t createLayer(const VtsDisplay& display) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(display.get(), kBufferSlotCount, &layer).isOk());
-
- auto resourceIt = mDisplayResources.find(display.get());
- if (resourceIt == mDisplayResources.end()) {
- resourceIt = mDisplayResources.insert({display.get(), DisplayResource(false)}).first;
- }
-
- EXPECT_TRUE(resourceIt->second.layers.insert(layer).second)
- << "duplicated layer id " << layer;
-
- return layer;
- }
-
- void destroyAllLayers() {
- for (const auto& it : mDisplayResources) {
- auto display = it.first;
- const DisplayResource& resource = it.second;
-
- for (auto layer : resource.layers) {
- const auto error = mComposerClient->destroyLayer(display, layer);
- EXPECT_TRUE(error.isOk());
- }
-
- if (resource.isVirtual) {
- const auto error = mComposerClient->destroyVirtualDisplay(display);
- EXPECT_TRUE(error.isOk());
- }
- }
- mDisplayResources.clear();
- }
-
- void destroyLayer(const VtsDisplay& display, int64_t layer) {
- auto const error = mComposerClient->destroyLayer(display.get(), layer);
- ASSERT_TRUE(error.isOk()) << "failed to destroy layer " << layer;
-
- auto resourceIt = mDisplayResources.find(display.get());
- ASSERT_NE(mDisplayResources.end(), resourceIt);
- resourceIt->second.layers.erase(layer);
- }
-
bool hasCapability(Capability capability) {
- std::vector<Capability> capabilities;
- EXPECT_TRUE(mComposer->getCapabilities(&capabilities).isOk());
+ const auto& [status, capabilities] = mComposerClient->getCapabilities();
+ EXPECT_TRUE(status.isOk());
return std::any_of(
capabilities.begin(), capabilities.end(),
[&](const Capability& activeCapability) { return activeCapability == capability; });
}
- // returns an invalid display id (one that has not been registered to a
- // display. Currently assuming that a device will never have close to
- // std::numeric_limit<uint64_t>::max() displays registered while running tests
- int64_t GetInvalidDisplayId() {
- int64_t id = std::numeric_limits<int64_t>::max();
- while (id > 0) {
- if (std::none_of(mDisplays.begin(), mDisplays.end(),
- [&](const VtsDisplay& display) { return id == display.get(); })) {
- return id;
- }
- id--;
- }
+ const VtsDisplay& getPrimaryDisplay() const { return mDisplays[0]; }
- // Although 0 could be an invalid display, a return value of 0
- // from GetInvalidDisplayId means all other ids are in use, a condition which
- // we are assuming a device will never have
- EXPECT_NE(0, id);
- return id;
- }
+ int64_t getPrimaryDisplayId() const { return getPrimaryDisplay().getDisplayId(); }
- std::vector<VtsDisplay> waitForDisplays() {
- while (true) {
- // Sleep for a small period of time to allow all built-in displays
- // to post hotplug events
- std::this_thread::sleep_for(5ms);
- std::vector<int64_t> displays = mComposerCallback->getDisplays();
- if (displays.empty()) {
- continue;
- }
+ int64_t getInvalidDisplayId() const { return mComposerClient->getInvalidDisplayId(); }
- std::vector<VtsDisplay> vtsDisplays;
- vtsDisplays.reserve(displays.size());
- for (int64_t display : displays) {
- int32_t activeConfig;
- EXPECT_TRUE(mComposerClient->getActiveConfig(display, &activeConfig).isOk());
- int32_t displayWidth;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display, activeConfig,
- DisplayAttribute::WIDTH, &displayWidth)
- .isOk());
- int32_t displayHeight;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display, activeConfig,
- DisplayAttribute::HEIGHT, &displayHeight)
- .isOk());
- vtsDisplays.emplace_back(VtsDisplay{display, displayWidth, displayHeight});
- }
-
- return vtsDisplays;
- }
- }
-
- // returns an invalid config id which is std::numeric_limit<int32_t>::max()
- int32_t GetInvalidConfigId() { return IComposerClient::INVALID_CONFIGURATION; }
-
- ndk::ScopedAStatus setActiveConfigWithConstraints(
- VtsDisplay& display, int32_t config, const VsyncPeriodChangeConstraints& constraints,
- VsyncPeriodChangeTimeline* timeline) {
- auto error = mComposerClient->setActiveConfigWithConstraints(display.get(), config,
- constraints, timeline);
- if (error.isOk()) {
- int32_t displayWidth;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config,
- DisplayAttribute::WIDTH, &displayWidth)
- .isOk());
- int32_t displayHeight;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config,
- DisplayAttribute::HEIGHT, &displayHeight)
- .isOk());
- display.setDimensions(displayWidth, displayHeight);
- }
- return error;
- }
+ VtsDisplay& getEditablePrimaryDisplay() { return mDisplays[0]; }
struct TestParameters {
nsecs_t delayForChange;
bool refreshMiss;
};
- // Keep track of all virtual displays and layers. When a test fails with
- // ASSERT_*, the destructor will clean up the resources for the test.
- struct DisplayResource {
- DisplayResource(bool isVirtual_) : isVirtual(isVirtual_) {}
-
- bool isVirtual;
- std::unordered_set<int64_t> layers;
- };
-
- std::shared_ptr<IComposer> mComposer;
- std::shared_ptr<IComposerClient> mComposerClient;
- int64_t mInvalidDisplayId;
- int64_t mPrimaryDisplay;
+ std::unique_ptr<VtsComposerClient> mComposerClient;
std::vector<VtsDisplay> mDisplays;
- std::shared_ptr<GraphicsComposerCallback> mComposerCallback;
// use the slot count usually set by SF
static constexpr uint32_t kBufferSlotCount = 64;
- std::unordered_map<int64_t, DisplayResource> mDisplayResources;
- int32_t mDisplayWidth;
- int32_t mDisplayHeight;
};
-TEST_P(GraphicsComposerAidlTest, getDisplayCapabilitiesBadDisplay) {
- std::vector<DisplayCapability> capabilities;
- const auto error = mComposerClient->getDisplayCapabilities(mInvalidDisplayId, &capabilities);
+TEST_P(GraphicsComposerAidlTest, GetDisplayCapabilities_BadDisplay) {
+ const auto& [status, _] = mComposerClient->getDisplayCapabilities(getInvalidDisplayId());
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, getDisplayCapabilities) {
+TEST_P(GraphicsComposerAidlTest, GetDisplayCapabilities) {
for (const auto& display : mDisplays) {
- std::vector<DisplayCapability> capabilities;
+ const auto& [status, capabilities] =
+ mComposerClient->getDisplayCapabilities(display.getDisplayId());
- EXPECT_TRUE(mComposerClient->getDisplayCapabilities(display.get(), &capabilities).isOk());
+ EXPECT_TRUE(status.isOk());
}
}
TEST_P(GraphicsComposerAidlTest, DumpDebugInfo) {
- std::string debugInfo;
- EXPECT_TRUE(mComposer->dumpDebugInfo(&debugInfo).isOk());
+ ASSERT_TRUE(mComposerClient->dumpDebugInfo().isOk());
}
TEST_P(GraphicsComposerAidlTest, CreateClientSingleton) {
std::shared_ptr<IComposerClient> composerClient;
- const auto error = mComposer->createClient(&composerClient);
+ const auto& status = mComposerClient->createClient();
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_NO_RESOURCES, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_NO_RESOURCES, status.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, GetDisplayIdentificationData) {
- DisplayIdentification displayIdentification0;
-
- const auto error =
- mComposerClient->getDisplayIdentificationData(mPrimaryDisplay, &displayIdentification0);
- if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ const auto& [status0, displayIdentification0] =
+ mComposerClient->getDisplayIdentificationData(getPrimaryDisplayId());
+ if (!status0.isOk() && status0.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ GTEST_SUCCEED() << "Display identification data not supported, skipping test";
return;
}
- ASSERT_TRUE(error.isOk()) << "failed to get display identification data";
+ ASSERT_TRUE(status0.isOk()) << "failed to get display identification data";
ASSERT_FALSE(displayIdentification0.data.empty());
constexpr size_t kEdidBlockSize = 128;
@@ -355,10 +178,9 @@
static_cast<uint8_t>(0)))
<< "EDID base block doesn't checksum";
- DisplayIdentification displayIdentification1;
- ASSERT_TRUE(
- mComposerClient->getDisplayIdentificationData(mPrimaryDisplay, &displayIdentification1)
- .isOk());
+ const auto& [status1, displayIdentification1] =
+ mComposerClient->getDisplayIdentificationData(getPrimaryDisplayId());
+ ASSERT_TRUE(status1.isOk());
ASSERT_EQ(displayIdentification0.port, displayIdentification1.port) << "ports are not stable";
ASSERT_TRUE(displayIdentification0.data.size() == displayIdentification1.data.size() &&
@@ -368,42 +190,42 @@
}
TEST_P(GraphicsComposerAidlTest, GetHdrCapabilities) {
- HdrCapabilities hdrCapabilities;
- const auto error = mComposerClient->getHdrCapabilities(mPrimaryDisplay, &hdrCapabilities);
+ const auto& [status, hdrCapabilities] =
+ mComposerClient->getHdrCapabilities(getPrimaryDisplayId());
- ASSERT_TRUE(error.isOk());
- ASSERT_TRUE(hdrCapabilities.maxLuminance >= hdrCapabilities.minLuminance);
+ ASSERT_TRUE(status.isOk());
+ EXPECT_TRUE(hdrCapabilities.maxLuminance >= hdrCapabilities.minLuminance);
}
TEST_P(GraphicsComposerAidlTest, GetPerFrameMetadataKeys) {
- std::vector<PerFrameMetadataKey> keys;
- const auto error = mComposerClient->getPerFrameMetadataKeys(mPrimaryDisplay, &keys);
-
- if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ const auto& [status, keys] = mComposerClient->getPerFrameMetadataKeys(getPrimaryDisplayId());
+ if (!status.isOk() && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
GTEST_SUCCEED() << "getPerFrameMetadataKeys is not supported";
return;
}
- EXPECT_TRUE(error.isOk());
- ASSERT_TRUE(keys.size() >= 0);
+
+ ASSERT_TRUE(status.isOk());
+ EXPECT_TRUE(keys.size() >= 0);
}
TEST_P(GraphicsComposerAidlTest, GetReadbackBufferAttributes) {
- ReadbackBufferAttributes readBackBufferAttributes;
- const auto error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay,
- &readBackBufferAttributes);
-
- if (error.isOk()) {
- EXPECT_EQ(EX_NONE, error.getServiceSpecificError());
+ const auto& [status, _] = mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId());
+ if (!status.isOk() && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ GTEST_SUCCEED() << "getReadbackBufferAttributes is not supported";
+ return;
}
+
+ ASSERT_TRUE(status.isOk());
}
TEST_P(GraphicsComposerAidlTest, GetRenderIntents) {
- std::vector<ColorMode> modes;
- EXPECT_TRUE(mComposerClient->getColorModes(mPrimaryDisplay, &modes).isOk());
- for (auto mode : modes) {
- std::vector<RenderIntent> intents;
- EXPECT_TRUE(mComposerClient->getRenderIntents(mPrimaryDisplay, mode, &intents).isOk());
+ const auto& [status, modes] = mComposerClient->getColorModes(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
+ for (auto mode : modes) {
+ const auto& [intentStatus, intents] =
+ mComposerClient->getRenderIntents(getPrimaryDisplayId(), mode);
+ EXPECT_TRUE(intentStatus.isOk());
bool isHdr;
switch (mode) {
case ColorMode::BT2100_PQ:
@@ -417,158 +239,157 @@
RenderIntent requiredIntent =
isHdr ? RenderIntent::TONE_MAP_COLORIMETRIC : RenderIntent::COLORIMETRIC;
- auto iter = std::find(intents.cbegin(), intents.cend(), requiredIntent);
+ const auto iter = std::find(intents.cbegin(), intents.cend(), requiredIntent);
EXPECT_NE(intents.cend(), iter);
}
}
-TEST_P(GraphicsComposerAidlTest, GetRenderIntentsBadDisplay) {
- std::vector<ColorMode> modes;
- EXPECT_TRUE(mComposerClient->getColorModes(mPrimaryDisplay, &modes).isOk());
+TEST_P(GraphicsComposerAidlTest, GetRenderIntents_BadDisplay) {
+ const auto& [status, modes] = mComposerClient->getColorModes(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
+
for (auto mode : modes) {
- std::vector<RenderIntent> renderIntents;
- const auto error =
- mComposerClient->getRenderIntents(mInvalidDisplayId, mode, &renderIntents);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ const auto& [intentStatus, _] =
+ mComposerClient->getRenderIntents(getInvalidDisplayId(), mode);
+
+ EXPECT_FALSE(intentStatus.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, intentStatus.getServiceSpecificError());
}
}
-TEST_P(GraphicsComposerAidlTest, GetRenderIntentsBadParameter) {
- std::vector<RenderIntent> renderIntents;
- const auto error = mComposerClient->getRenderIntents(
- mPrimaryDisplay, static_cast<ColorMode>(-1), &renderIntents);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, error.getServiceSpecificError());
+TEST_P(GraphicsComposerAidlTest, GetRenderIntents_BadParameter) {
+ const auto& [status, _] =
+ mComposerClient->getRenderIntents(getPrimaryDisplayId(), static_cast<ColorMode>(-1));
+
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, GetColorModes) {
- std::vector<ColorMode> colorModes;
- EXPECT_TRUE(mComposerClient->getColorModes(mPrimaryDisplay, &colorModes).isOk());
+ const auto& [status, colorModes] = mComposerClient->getColorModes(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
- auto native = std::find(colorModes.cbegin(), colorModes.cend(), ColorMode::NATIVE);
- ASSERT_NE(colorModes.cend(), native);
+ const auto native = std::find(colorModes.cbegin(), colorModes.cend(), ColorMode::NATIVE);
+ EXPECT_NE(colorModes.cend(), native);
}
-TEST_P(GraphicsComposerAidlTest, GetColorModeBadDisplay) {
- std::vector<ColorMode> colorModes;
- const auto error = mComposerClient->getColorModes(mInvalidDisplayId, &colorModes);
+TEST_P(GraphicsComposerAidlTest, GetColorMode_BadDisplay) {
+ const auto& [status, _] = mComposerClient->getColorModes(getInvalidDisplayId());
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, SetColorMode) {
- std::vector<ColorMode> colorModes;
- EXPECT_TRUE(mComposerClient->getColorModes(mPrimaryDisplay, &colorModes).isOk());
+ const auto& [status, colorModes] = mComposerClient->getColorModes(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
+
for (auto mode : colorModes) {
- std::vector<RenderIntent> intents;
- EXPECT_TRUE(mComposerClient->getRenderIntents(mPrimaryDisplay, mode, &intents).isOk())
- << "failed to get render intents";
+ const auto& [intentStatus, intents] =
+ mComposerClient->getRenderIntents(getPrimaryDisplayId(), mode);
+ EXPECT_TRUE(intentStatus.isOk()) << "failed to get render intents";
+
for (auto intent : intents) {
- const auto error = mComposerClient->setColorMode(mPrimaryDisplay, mode, intent);
- EXPECT_TRUE(error.isOk() ||
- IComposerClient::EX_UNSUPPORTED == error.getServiceSpecificError())
+ const auto modeStatus =
+ mComposerClient->setColorMode(getPrimaryDisplayId(), mode, intent);
+ EXPECT_TRUE(modeStatus.isOk() ||
+ IComposerClient::EX_UNSUPPORTED == modeStatus.getServiceSpecificError())
<< "failed to set color mode";
}
}
- const auto error = mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::NATIVE,
- RenderIntent::COLORIMETRIC);
- EXPECT_TRUE(error.isOk() || IComposerClient::EX_UNSUPPORTED == error.getServiceSpecificError())
+ const auto modeStatus = mComposerClient->setColorMode(getPrimaryDisplayId(), ColorMode::NATIVE,
+ RenderIntent::COLORIMETRIC);
+ EXPECT_TRUE(modeStatus.isOk() ||
+ IComposerClient::EX_UNSUPPORTED == modeStatus.getServiceSpecificError())
<< "failed to set color mode";
}
-TEST_P(GraphicsComposerAidlTest, SetColorModeBadDisplay) {
- std::vector<ColorMode> colorModes;
- EXPECT_TRUE(mComposerClient->getColorModes(mPrimaryDisplay, &colorModes).isOk());
- for (auto mode : colorModes) {
- std::vector<RenderIntent> intents;
- EXPECT_TRUE(mComposerClient->getRenderIntents(mPrimaryDisplay, mode, &intents).isOk())
- << "failed to get render intents";
- for (auto intent : intents) {
- auto const error = mComposerClient->setColorMode(mInvalidDisplayId, mode, intent);
+TEST_P(GraphicsComposerAidlTest, SetColorMode_BadDisplay) {
+ const auto& [status, colorModes] = mComposerClient->getColorModes(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ for (auto mode : colorModes) {
+ const auto& [intentStatus, intents] =
+ mComposerClient->getRenderIntents(getPrimaryDisplayId(), mode);
+ ASSERT_TRUE(intentStatus.isOk()) << "failed to get render intents";
+
+ for (auto intent : intents) {
+ auto const modeStatus =
+ mComposerClient->setColorMode(getInvalidDisplayId(), mode, intent);
+
+ EXPECT_FALSE(modeStatus.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, modeStatus.getServiceSpecificError());
}
}
}
-TEST_P(GraphicsComposerAidlTest, SetColorModeBadParameter) {
- const auto colorModeError = mComposerClient->setColorMode(
- mPrimaryDisplay, static_cast<ColorMode>(-1), RenderIntent::COLORIMETRIC);
+TEST_P(GraphicsComposerAidlTest, SetColorMode_BadParameter) {
+ auto status = mComposerClient->setColorMode(getPrimaryDisplayId(), static_cast<ColorMode>(-1),
+ RenderIntent::COLORIMETRIC);
- EXPECT_FALSE(colorModeError.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, colorModeError.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
- const auto renderIntentError = mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::NATIVE,
- static_cast<RenderIntent>(-1));
+ status = mComposerClient->setColorMode(getPrimaryDisplayId(), ColorMode::NATIVE,
+ static_cast<RenderIntent>(-1));
- EXPECT_FALSE(renderIntentError.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, renderIntentError.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, GetDisplayedContentSamplingAttributes) {
- int constexpr invalid = -1;
+ int constexpr kInvalid = -1;
+ const auto& [status, format] =
+ mComposerClient->getDisplayedContentSamplingAttributes(getPrimaryDisplayId());
- DisplayContentSamplingAttributes format;
- auto error = mComposerClient->getDisplayedContentSamplingAttributes(mPrimaryDisplay, &format);
-
- if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ if (!status.isOk() && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
SUCCEED() << "Device does not support optional extension. Test skipped";
return;
}
- EXPECT_TRUE(error.isOk());
- EXPECT_NE(format.format, static_cast<common::PixelFormat>(invalid));
- EXPECT_NE(format.dataspace, static_cast<common::Dataspace>(invalid));
- EXPECT_NE(format.componentMask, static_cast<FormatColorComponent>(invalid));
+ ASSERT_TRUE(status.isOk());
+ EXPECT_NE(kInvalid, static_cast<int>(format.format));
+ EXPECT_NE(kInvalid, static_cast<int>(format.dataspace));
+ EXPECT_NE(kInvalid, static_cast<int>(format.componentMask));
};
TEST_P(GraphicsComposerAidlTest, SetDisplayedContentSamplingEnabled) {
- auto const maxFrames = 10;
+ int constexpr kMaxFrames = 10;
FormatColorComponent enableAllComponents = FormatColorComponent::FORMAT_COMPONENT_0;
- auto error = mComposerClient->setDisplayedContentSamplingEnabled(
- mPrimaryDisplay, true, enableAllComponents, maxFrames);
- if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ auto status = mComposerClient->setDisplayedContentSamplingEnabled(
+ getPrimaryDisplayId(), /*isEnabled*/ true, enableAllComponents, kMaxFrames);
+ if (!status.isOk() && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
SUCCEED() << "Device does not support optional extension. Test skipped";
return;
}
- EXPECT_TRUE(error.isOk());
+ EXPECT_TRUE(status.isOk());
- error = mComposerClient->setDisplayedContentSamplingEnabled(mPrimaryDisplay, false,
- enableAllComponents, maxFrames);
- EXPECT_TRUE(error.isOk());
+ status = mComposerClient->setDisplayedContentSamplingEnabled(
+ getPrimaryDisplayId(), /*isEnabled*/ false, enableAllComponents, kMaxFrames);
+ EXPECT_TRUE(status.isOk());
}
TEST_P(GraphicsComposerAidlTest, GetDisplayedContentSample) {
- DisplayContentSamplingAttributes displayContentSamplingAttributes;
- int constexpr invalid = -1;
- displayContentSamplingAttributes.format = static_cast<common::PixelFormat>(invalid);
- displayContentSamplingAttributes.dataspace = static_cast<common::Dataspace>(invalid);
- displayContentSamplingAttributes.componentMask = static_cast<FormatColorComponent>(invalid);
- auto error = mComposerClient->getDisplayedContentSamplingAttributes(
- mPrimaryDisplay, &displayContentSamplingAttributes);
- if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ const auto& [status, displayContentSamplingAttributes] =
+ mComposerClient->getDisplayedContentSamplingAttributes(getPrimaryDisplayId());
+ if (!status.isOk() && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
SUCCEED() << "Sampling attributes aren't supported on this device, test skipped";
return;
}
- int64_t maxFrames = 10;
- int64_t timestamp = 0;
- int64_t frameCount = 0;
- DisplayContentSample displayContentSample;
- error = mComposerClient->getDisplayedContentSample(mPrimaryDisplay, maxFrames, timestamp,
- &displayContentSample);
- if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ int64_t constexpr kMaxFrames = 10;
+ int64_t constexpr kTimestamp = 0;
+ const auto& [sampleStatus, displayContentSample] = mComposerClient->getDisplayedContentSample(
+ getPrimaryDisplayId(), kMaxFrames, kTimestamp);
+ if (!sampleStatus.isOk() &&
+ sampleStatus.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
SUCCEED() << "Device does not support optional extension. Test skipped";
return;
}
- EXPECT_TRUE(error.isOk());
- EXPECT_LE(frameCount, maxFrames);
- std::vector<std::vector<int64_t>> histogram = {
+ EXPECT_TRUE(sampleStatus.isOk());
+ const std::vector<std::vector<int64_t>> histogram = {
displayContentSample.sampleComponent0, displayContentSample.sampleComponent1,
displayContentSample.sampleComponent2, displayContentSample.sampleComponent3};
@@ -579,18 +400,24 @@
}
}
-TEST_P(GraphicsComposerAidlTest, getDisplayConnectionType) {
- DisplayConnectionType type;
- EXPECT_FALSE(mComposerClient->getDisplayConnectionType(mInvalidDisplayId, &type).isOk());
+TEST_P(GraphicsComposerAidlTest, GetDisplayConnectionType) {
+ const auto& [status, type] = mComposerClient->getDisplayConnectionType(getInvalidDisplayId());
+
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
+
for (const auto& display : mDisplays) {
- EXPECT_TRUE(mComposerClient->getDisplayConnectionType(display.get(), &type).isOk());
+ const auto& [connectionTypeStatus, _] =
+ mComposerClient->getDisplayConnectionType(display.getDisplayId());
+ EXPECT_TRUE(connectionTypeStatus.isOk());
}
}
-TEST_P(GraphicsComposerAidlTest, getDisplayAttribute) {
+TEST_P(GraphicsComposerAidlTest, GetDisplayAttribute) {
for (const auto& display : mDisplays) {
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(display.get(), &configs).isOk());
+ const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId());
+ EXPECT_TRUE(status.isOk());
+
for (const auto& config : configs) {
const std::array<DisplayAttribute, 4> requiredAttributes = {{
DisplayAttribute::WIDTH,
@@ -598,11 +425,10 @@
DisplayAttribute::VSYNC_PERIOD,
DisplayAttribute::CONFIG_GROUP,
}};
- int32_t value;
for (const auto& attribute : requiredAttributes) {
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config, attribute, &value)
- .isOk());
+ const auto& [attribStatus, value] = mComposerClient->getDisplayAttribute(
+ display.getDisplayId(), config, attribute);
+ EXPECT_TRUE(attribStatus.isOk());
EXPECT_NE(-1, value);
}
@@ -611,22 +437,19 @@
DisplayAttribute::DPI_Y,
}};
for (const auto& attribute : optionalAttributes) {
- const auto error = mComposerClient->getDisplayAttribute(display.get(), config,
- attribute, &value);
- if (error.isOk()) {
- EXPECT_EQ(EX_NONE, error.getServiceSpecificError());
- } else {
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
- }
+ const auto& [attribStatus, value] = mComposerClient->getDisplayAttribute(
+ display.getDisplayId(), config, attribute);
+ EXPECT_TRUE(attribStatus.isOk() || IComposerClient::EX_UNSUPPORTED ==
+ attribStatus.getServiceSpecificError());
}
}
}
}
-TEST_P(GraphicsComposerAidlTest, checkConfigsAreValid) {
+TEST_P(GraphicsComposerAidlTest, CheckConfigsAreValid) {
for (const auto& display : mDisplays) {
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(display.get(), &configs).isOk());
+ const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId());
+ EXPECT_TRUE(status.isOk());
EXPECT_FALSE(std::any_of(configs.begin(), configs.end(), [](auto config) {
return config == IComposerClient::INVALID_CONFIGURATION;
@@ -634,349 +457,287 @@
}
}
-TEST_P(GraphicsComposerAidlTest, getDisplayAttributeConfigsInAGroupDifferOnlyByVsyncPeriod) {
- struct Resolution {
- int32_t width;
- int32_t height;
- };
- struct Dpi {
- int32_t x;
- int32_t y;
- };
- for (const auto& display : mDisplays) {
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(display.get(), &configs).isOk());
- std::unordered_map<int32_t, Resolution> configGroupToResolutionMap;
- std::unordered_map<int32_t, Dpi> configGroupToDpiMap;
- for (const auto& config : configs) {
- int32_t configGroup = -1;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config,
- DisplayAttribute::CONFIG_GROUP, &configGroup)
- .isOk());
- int32_t width = -1;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config,
- DisplayAttribute::WIDTH, &width)
- .isOk());
- int32_t height = -1;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config,
- DisplayAttribute::HEIGHT, &height)
- .isOk());
- if (configGroupToResolutionMap.find(configGroup) == configGroupToResolutionMap.end()) {
- configGroupToResolutionMap[configGroup] = {width, height};
- }
- EXPECT_EQ(configGroupToResolutionMap[configGroup].width, width);
- EXPECT_EQ(configGroupToResolutionMap[configGroup].height, height);
+TEST_P(GraphicsComposerAidlTest, GetDisplayVsyncPeriod_BadDisplay) {
+ const auto& [status, vsyncPeriodNanos] =
+ mComposerClient->getDisplayVsyncPeriod(getInvalidDisplayId());
- int32_t dpiX = -1;
- mComposerClient->getDisplayAttribute(display.get(), config, DisplayAttribute::DPI_X,
- &dpiX);
-
- int32_t dpiY = -1;
- mComposerClient->getDisplayAttribute(display.get(), config, DisplayAttribute::DPI_Y,
- &dpiY);
- if (dpiX == -1 && dpiY == -1) {
- continue;
- }
-
- if (configGroupToDpiMap.find(configGroup) == configGroupToDpiMap.end()) {
- configGroupToDpiMap[configGroup] = {dpiX, dpiY};
- }
- EXPECT_EQ(configGroupToDpiMap[configGroup].x, dpiX);
- EXPECT_EQ(configGroupToDpiMap[configGroup].y, dpiY);
- }
- }
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, getDisplayVsyncPeriod_BadDisplay) {
- int32_t vsyncPeriodNanos;
- const auto error = mComposerClient->getDisplayVsyncPeriod(mInvalidDisplayId, &vsyncPeriodNanos);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
-}
-
-TEST_P(GraphicsComposerAidlTest, setActiveConfigWithConstraints_BadDisplay) {
- VsyncPeriodChangeTimeline timeline;
+TEST_P(GraphicsComposerAidlTest, SetActiveConfigWithConstraints_BadDisplay) {
VsyncPeriodChangeConstraints constraints;
-
constraints.seamlessRequired = false;
constraints.desiredTimeNanos = systemTime();
- int32_t config = 0;
- auto const error = mComposerClient->setActiveConfigWithConstraints(mInvalidDisplayId, config,
- constraints, &timeline);
+ auto invalidDisplay = VtsDisplay(getInvalidDisplayId());
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ const auto& [status, timeline] = mComposerClient->setActiveConfigWithConstraints(
+ &invalidDisplay, /*config*/ 0, constraints);
+
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, setActiveConfigWithConstraints_BadConfig) {
- VsyncPeriodChangeTimeline timeline;
+TEST_P(GraphicsComposerAidlTest, SetActiveConfigWithConstraints_BadConfig) {
VsyncPeriodChangeConstraints constraints;
-
constraints.seamlessRequired = false;
constraints.desiredTimeNanos = systemTime();
for (VtsDisplay& display : mDisplays) {
- int32_t invalidConfigId = GetInvalidConfigId();
- const auto error =
- setActiveConfigWithConstraints(display, invalidConfigId, constraints, &timeline);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_CONFIG, error.getServiceSpecificError());
+ int32_t constexpr kInvalidConfigId = IComposerClient::INVALID_CONFIGURATION;
+ const auto& [status, _] = mComposerClient->setActiveConfigWithConstraints(
+ &display, kInvalidConfigId, constraints);
+
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_CONFIG, status.getServiceSpecificError());
}
}
-TEST_P(GraphicsComposerAidlTest, setBootDisplayConfig_BadDisplay) {
- int32_t config = 0;
- auto const error = mComposerClient->setBootDisplayConfig(mInvalidDisplayId, config);
+TEST_P(GraphicsComposerAidlTest, SetBootDisplayConfig_BadDisplay) {
+ const auto& status = mComposerClient->setBootDisplayConfig(getInvalidDisplayId(), /*config*/ 0);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, setBootDisplayConfig_BadConfig) {
+TEST_P(GraphicsComposerAidlTest, SetBootDisplayConfig_BadConfig) {
for (VtsDisplay& display : mDisplays) {
- int32_t invalidConfigId = GetInvalidConfigId();
- const auto error = mComposerClient->setBootDisplayConfig(display.get(), invalidConfigId);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_CONFIG, error.getServiceSpecificError());
+ int32_t constexpr kInvalidConfigId = IComposerClient::INVALID_CONFIGURATION;
+ const auto& status =
+ mComposerClient->setBootDisplayConfig(display.getDisplayId(), kInvalidConfigId);
+
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_CONFIG, status.getServiceSpecificError());
}
}
-TEST_P(GraphicsComposerAidlTest, setBootDisplayConfig) {
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(mPrimaryDisplay, &configs).isOk());
- for (auto config : configs) {
- EXPECT_TRUE(mComposerClient->setBootDisplayConfig(mPrimaryDisplay, config).isOk());
+TEST_P(GraphicsComposerAidlTest, SetBootDisplayConfig) {
+ const auto& [status, configs] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
+ for (const auto& config : configs) {
+ EXPECT_TRUE(mComposerClient->setBootDisplayConfig(getPrimaryDisplayId(), config).isOk());
}
}
-TEST_P(GraphicsComposerAidlTest, clearBootDisplayConfig_BadDisplay) {
- auto const error = mComposerClient->clearBootDisplayConfig(mInvalidDisplayId);
+TEST_P(GraphicsComposerAidlTest, ClearBootDisplayConfig_BadDisplay) {
+ const auto& status = mComposerClient->clearBootDisplayConfig(getInvalidDisplayId());
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, clearBootDisplayConfig) {
- EXPECT_TRUE(mComposerClient->clearBootDisplayConfig(mPrimaryDisplay).isOk());
+TEST_P(GraphicsComposerAidlTest, ClearBootDisplayConfig) {
+ EXPECT_TRUE(mComposerClient->clearBootDisplayConfig(getPrimaryDisplayId()).isOk());
}
-TEST_P(GraphicsComposerAidlTest, getPreferredBootDisplayConfig_BadDisplay) {
- int32_t config;
- auto const error = mComposerClient->getPreferredBootDisplayConfig(mInvalidDisplayId, &config);
+TEST_P(GraphicsComposerAidlTest, GetPreferredBootDisplayConfig_BadDisplay) {
+ const auto& [status, _] = mComposerClient->getPreferredBootDisplayConfig(getInvalidDisplayId());
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, getPreferredBootDisplayConfig) {
- int32_t preferredDisplayConfig = 0;
- auto const error = mComposerClient->getPreferredBootDisplayConfig(mPrimaryDisplay,
- &preferredDisplayConfig);
- EXPECT_TRUE(error.isOk());
+TEST_P(GraphicsComposerAidlTest, GetPreferredBootDisplayConfig) {
+ const auto& [status, preferredDisplayConfig] =
+ mComposerClient->getPreferredBootDisplayConfig(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(mPrimaryDisplay, &configs).isOk());
+ const auto& [configStatus, configs] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId());
+
+ EXPECT_TRUE(configStatus.isOk());
EXPECT_NE(configs.end(), std::find(configs.begin(), configs.end(), preferredDisplayConfig));
}
-TEST_P(GraphicsComposerAidlTest, setAutoLowLatencyModeBadDisplay) {
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY,
- mComposerClient->setAutoLowLatencyMode(mInvalidDisplayId, true)
- .getServiceSpecificError());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY,
- mComposerClient->setAutoLowLatencyMode(mInvalidDisplayId, false)
- .getServiceSpecificError());
+TEST_P(GraphicsComposerAidlTest, SetAutoLowLatencyMode_BadDisplay) {
+ auto status = mComposerClient->setAutoLowLatencyMode(getInvalidDisplayId(), /*isEnabled*/ true);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
+
+ status = mComposerClient->setAutoLowLatencyMode(getInvalidDisplayId(), /*isEnabled*/ false);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, setAutoLowLatencyMode) {
+TEST_P(GraphicsComposerAidlTest, SetAutoLowLatencyMode) {
for (const auto& display : mDisplays) {
- std::vector<DisplayCapability> capabilities;
- const auto error = mComposerClient->getDisplayCapabilities(display.get(), &capabilities);
- EXPECT_TRUE(error.isOk());
+ const auto& [status, capabilities] =
+ mComposerClient->getDisplayCapabilities(display.getDisplayId());
+ ASSERT_TRUE(status.isOk());
const bool allmSupport =
std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::AUTO_LOW_LATENCY_MODE) != capabilities.end();
if (!allmSupport) {
- const auto errorIsOn = mComposerClient->setAutoLowLatencyMode(display.get(), true);
- EXPECT_FALSE(errorIsOn.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, errorIsOn.getServiceSpecificError());
- const auto errorIsOff = mComposerClient->setAutoLowLatencyMode(display.get(), false);
- EXPECT_FALSE(errorIsOff.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, errorIsOff.getServiceSpecificError());
+ const auto& statusIsOn = mComposerClient->setAutoLowLatencyMode(display.getDisplayId(),
+ /*isEnabled*/ true);
+ EXPECT_FALSE(statusIsOn.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, statusIsOn.getServiceSpecificError());
+ const auto& statusIsOff = mComposerClient->setAutoLowLatencyMode(display.getDisplayId(),
+ /*isEnabled*/ false);
+ EXPECT_FALSE(statusIsOff.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, statusIsOff.getServiceSpecificError());
GTEST_SUCCEED() << "Auto Low Latency Mode is not supported on display "
- << std::to_string(display.get()) << ", skipping test";
+ << std::to_string(display.getDisplayId()) << ", skipping test";
return;
}
- EXPECT_TRUE(mComposerClient->setAutoLowLatencyMode(display.get(), true).isOk());
- EXPECT_TRUE(mComposerClient->setAutoLowLatencyMode(display.get(), false).isOk());
+ EXPECT_TRUE(mComposerClient->setAutoLowLatencyMode(display.getDisplayId(), true).isOk());
+ EXPECT_TRUE(mComposerClient->setAutoLowLatencyMode(display.getDisplayId(), false).isOk());
}
}
-TEST_P(GraphicsComposerAidlTest, getSupportedContentTypesBadDisplay) {
- std::vector<ContentType> supportedContentTypes;
- const auto error =
- mComposerClient->getSupportedContentTypes(mInvalidDisplayId, &supportedContentTypes);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+TEST_P(GraphicsComposerAidlTest, GetSupportedContentTypes_BadDisplay) {
+ const auto& [status, _] = mComposerClient->getSupportedContentTypes(getInvalidDisplayId());
+
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, getSupportedContentTypes) {
- std::vector<ContentType> supportedContentTypes;
+TEST_P(GraphicsComposerAidlTest, GetSupportedContentTypes) {
for (const auto& display : mDisplays) {
- supportedContentTypes.clear();
- const auto error =
- mComposerClient->getSupportedContentTypes(display.get(), &supportedContentTypes);
-
- ASSERT_TRUE(error.isOk());
+ const auto& [status, supportedContentTypes] =
+ mComposerClient->getSupportedContentTypes(display.getDisplayId());
+ ASSERT_TRUE(status.isOk());
const bool noneSupported =
std::find(supportedContentTypes.begin(), supportedContentTypes.end(),
ContentType::NONE) != supportedContentTypes.end();
+
EXPECT_FALSE(noneSupported);
}
}
-TEST_P(GraphicsComposerAidlTest, setContentTypeNoneAlwaysAccepted) {
+TEST_P(GraphicsComposerAidlTest, SetContentTypeNoneAlwaysAccepted) {
for (const auto& display : mDisplays) {
- const auto error = mComposerClient->setContentType(display.get(), ContentType::NONE);
- EXPECT_TRUE(error.isOk());
+ EXPECT_TRUE(
+ mComposerClient->setContentType(display.getDisplayId(), ContentType::NONE).isOk());
}
}
-TEST_P(GraphicsComposerAidlTest, setContentTypeBadDisplay) {
+TEST_P(GraphicsComposerAidlTest, SetContentType_BadDisplay) {
constexpr ContentType types[] = {ContentType::NONE, ContentType::GRAPHICS, ContentType::PHOTO,
ContentType::CINEMA, ContentType::GAME};
for (const auto& type : types) {
- auto const error = mComposerClient->setContentType(mInvalidDisplayId, type);
+ const auto& status = mComposerClient->setContentType(getInvalidDisplayId(), type);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
}
-TEST_P(GraphicsComposerAidlTest, setGraphicsContentType) {
+TEST_P(GraphicsComposerAidlTest, SetGraphicsContentType) {
Test_setContentType(ContentType::GRAPHICS, "GRAPHICS");
}
-TEST_P(GraphicsComposerAidlTest, setPhotoContentType) {
+TEST_P(GraphicsComposerAidlTest, SetPhotoContentType) {
Test_setContentType(ContentType::PHOTO, "PHOTO");
}
-TEST_P(GraphicsComposerAidlTest, setCinemaContentType) {
+TEST_P(GraphicsComposerAidlTest, SetCinemaContentType) {
Test_setContentType(ContentType::CINEMA, "CINEMA");
}
-TEST_P(GraphicsComposerAidlTest, setGameContentType) {
+TEST_P(GraphicsComposerAidlTest, SetGameContentType) {
Test_setContentType(ContentType::GAME, "GAME");
}
TEST_P(GraphicsComposerAidlTest, CreateVirtualDisplay) {
- int32_t maxVirtualDisplayCount;
- EXPECT_TRUE(mComposerClient->getMaxVirtualDisplayCount(&maxVirtualDisplayCount).isOk());
+ const auto& [status, maxVirtualDisplayCount] = mComposerClient->getMaxVirtualDisplayCount();
+ EXPECT_TRUE(status.isOk());
+
if (maxVirtualDisplayCount == 0) {
GTEST_SUCCEED() << "no virtual display support";
return;
}
- VirtualDisplay virtualDisplay;
+ const auto& [virtualDisplayStatus, virtualDisplay] = mComposerClient->createVirtualDisplay(
+ /*width*/ 64, /*height*/ 64, common::PixelFormat::IMPLEMENTATION_DEFINED,
+ kBufferSlotCount);
- EXPECT_TRUE(mComposerClient
- ->createVirtualDisplay(64, 64, common::PixelFormat::IMPLEMENTATION_DEFINED,
- kBufferSlotCount, &virtualDisplay)
- .isOk());
-
- ASSERT_TRUE(mDisplayResources.insert({virtualDisplay.display, DisplayResource(true)}).second)
- << "duplicated virtual display id " << virtualDisplay.display;
-
+ ASSERT_TRUE(virtualDisplayStatus.isOk());
EXPECT_TRUE(mComposerClient->destroyVirtualDisplay(virtualDisplay.display).isOk());
}
-TEST_P(GraphicsComposerAidlTest, DestroyVirtualDisplayBadDisplay) {
- int32_t maxDisplayCount = 0;
- EXPECT_TRUE(mComposerClient->getMaxVirtualDisplayCount(&maxDisplayCount).isOk());
+TEST_P(GraphicsComposerAidlTest, DestroyVirtualDisplay_BadDisplay) {
+ const auto& [status, maxDisplayCount] = mComposerClient->getMaxVirtualDisplayCount();
+ EXPECT_TRUE(status.isOk());
+
if (maxDisplayCount == 0) {
GTEST_SUCCEED() << "no virtual display support";
return;
}
- const auto error = mComposerClient->destroyVirtualDisplay(mInvalidDisplayId);
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ const auto& destroyStatus = mComposerClient->destroyVirtualDisplay(getInvalidDisplayId());
+
+ EXPECT_FALSE(destroyStatus.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, destroyStatus.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, CreateLayer) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+ const auto& [status, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
- EXPECT_TRUE(mComposerClient->destroyLayer(mPrimaryDisplay, layer).isOk());
+ EXPECT_TRUE(status.isOk());
+ EXPECT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer).isOk());
}
-TEST_P(GraphicsComposerAidlTest, CreateLayerBadDisplay) {
- int64_t layer;
- const auto error = mComposerClient->createLayer(mInvalidDisplayId, kBufferSlotCount, &layer);
+TEST_P(GraphicsComposerAidlTest, CreateLayer_BadDisplay) {
+ const auto& [status, _] = mComposerClient->createLayer(getInvalidDisplayId(), kBufferSlotCount);
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, DestroyLayerBadDisplay) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlTest, DestroyLayer_BadDisplay) {
+ const auto& [status, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(status.isOk());
- const auto error = mComposerClient->destroyLayer(mInvalidDisplayId, layer);
+ const auto& destroyStatus = mComposerClient->destroyLayer(getInvalidDisplayId(), layer);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
- EXPECT_TRUE(mComposerClient->destroyLayer(mPrimaryDisplay, layer).isOk());
+ EXPECT_FALSE(destroyStatus.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, destroyStatus.getServiceSpecificError());
+ ASSERT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer).isOk());
}
-TEST_P(GraphicsComposerAidlTest, DestroyLayerBadLayerError) {
+TEST_P(GraphicsComposerAidlTest, DestroyLayer_BadLayerError) {
// We haven't created any layers yet, so any id should be invalid
- const auto error = mComposerClient->destroyLayer(mPrimaryDisplay, 1);
+ const auto& status = mComposerClient->destroyLayer(getPrimaryDisplayId(), /*layer*/ 1);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_LAYER, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_LAYER, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, GetActiveConfigBadDisplay) {
- int32_t config;
- const auto error = mComposerClient->getActiveConfig(mInvalidDisplayId, &config);
+TEST_P(GraphicsComposerAidlTest, GetActiveConfig_BadDisplay) {
+ const auto& [status, _] = mComposerClient->getActiveConfig(getInvalidDisplayId());
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, GetDisplayConfig) {
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(mPrimaryDisplay, &configs).isOk());
+ const auto& [status, _] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
}
-TEST_P(GraphicsComposerAidlTest, GetDisplayConfigBadDisplay) {
- std::vector<int32_t> configs;
- const auto error = mComposerClient->getDisplayConfigs(mInvalidDisplayId, &configs);
+TEST_P(GraphicsComposerAidlTest, GetDisplayConfig_BadDisplay) {
+ const auto& [status, _] = mComposerClient->getDisplayConfigs(getInvalidDisplayId());
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, GetDisplayName) {
- std::string displayName;
- EXPECT_TRUE(mComposerClient->getDisplayName(mPrimaryDisplay, &displayName).isOk());
+ const auto& [status, _] = mComposerClient->getDisplayName(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
}
-TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientationBadDisplay) {
- Transform displayOrientation;
- const auto error =
- mComposerClient->getDisplayPhysicalOrientation(mInvalidDisplayId, &displayOrientation);
+TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) {
+ const auto& [status, _] = mComposerClient->getDisplayPhysicalOrientation(getInvalidDisplayId());
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation) {
@@ -987,94 +748,111 @@
Transform::ROT_270,
};
- Transform displayOrientation;
- const auto error =
- mComposerClient->getDisplayPhysicalOrientation(mPrimaryDisplay, &displayOrientation);
+ const auto& [status, displayOrientation] =
+ mComposerClient->getDisplayPhysicalOrientation(getPrimaryDisplayId());
- EXPECT_TRUE(error.isOk());
+ EXPECT_TRUE(status.isOk());
EXPECT_NE(std::find(allowedDisplayOrientations.begin(), allowedDisplayOrientations.end(),
displayOrientation),
allowedDisplayOrientations.end());
}
TEST_P(GraphicsComposerAidlTest, SetClientTargetSlotCount) {
- EXPECT_TRUE(
- mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kBufferSlotCount).isOk());
+ EXPECT_TRUE(mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kBufferSlotCount)
+ .isOk());
}
TEST_P(GraphicsComposerAidlTest, SetActiveConfig) {
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(mPrimaryDisplay, &configs).isOk());
- for (auto config : configs) {
- EXPECT_TRUE(mComposerClient->setActiveConfig(mPrimaryDisplay, config).isOk());
- int32_t config1;
- EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &config1).isOk());
+ const auto& [status, configs] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
+
+ for (const auto& config : configs) {
+ auto display = getEditablePrimaryDisplay();
+ EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config).isOk());
+ const auto& [configStatus, config1] =
+ mComposerClient->getActiveConfig(getPrimaryDisplayId());
+ EXPECT_TRUE(configStatus.isOk());
EXPECT_EQ(config, config1);
}
}
TEST_P(GraphicsComposerAidlTest, SetActiveConfigPowerCycle) {
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF).isOk());
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk());
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(mPrimaryDisplay, &configs).isOk());
- for (auto config : configs) {
- EXPECT_TRUE(mComposerClient->setActiveConfig(mPrimaryDisplay, config).isOk());
- int32_t config1;
- EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &config1).isOk());
+ const auto& [status, configs] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
+
+ for (const auto& config : configs) {
+ auto display = getEditablePrimaryDisplay();
+ EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config).isOk());
+ const auto& [config1Status, config1] =
+ mComposerClient->getActiveConfig(getPrimaryDisplayId());
+ EXPECT_TRUE(config1Status.isOk());
EXPECT_EQ(config, config1);
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF).isOk());
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON).isOk());
- EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &config1).isOk());
- EXPECT_EQ(config, config1);
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk());
+ const auto& [config2Status, config2] =
+ mComposerClient->getActiveConfig(getPrimaryDisplayId());
+ EXPECT_TRUE(config2Status.isOk());
+ EXPECT_EQ(config, config2);
}
}
TEST_P(GraphicsComposerAidlTest, SetPowerModeUnsupported) {
- std::vector<DisplayCapability> capabilities;
- auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
- ASSERT_TRUE(error.isOk());
+ const auto& [status, capabilities] =
+ mComposerClient->getDisplayCapabilities(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
+
const bool isDozeSupported = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::DOZE) != capabilities.end();
const bool isSuspendSupported = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::SUSPEND) != capabilities.end();
- if (!isDozeSupported) {
- error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::DOZE);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
- error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::DOZE_SUSPEND);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
+ if (!isDozeSupported) {
+ const auto& powerModeDozeStatus =
+ mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::DOZE);
+ EXPECT_FALSE(powerModeDozeStatus.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, powerModeDozeStatus.getServiceSpecificError());
+
+ const auto& powerModeDozeSuspendStatus =
+ mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::DOZE_SUSPEND);
+ EXPECT_FALSE(powerModeDozeSuspendStatus.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED,
+ powerModeDozeSuspendStatus.getServiceSpecificError());
}
if (!isSuspendSupported) {
- error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON_SUSPEND);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
+ const auto& powerModeSuspendStatus =
+ mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON_SUSPEND);
+ EXPECT_FALSE(powerModeSuspendStatus.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED,
+ powerModeSuspendStatus.getServiceSpecificError());
- error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::DOZE_SUSPEND);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
+ const auto& powerModeDozeSuspendStatus =
+ mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::DOZE_SUSPEND);
+ EXPECT_FALSE(powerModeDozeSuspendStatus.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED,
+ powerModeDozeSuspendStatus.getServiceSpecificError());
}
}
TEST_P(GraphicsComposerAidlTest, SetVsyncEnabled) {
- mComposerCallback->setVsyncAllowed(true);
+ mComposerClient->setVsyncAllowed(true);
- EXPECT_TRUE(mComposerClient->setVsyncEnabled(mPrimaryDisplay, true).isOk());
+ EXPECT_TRUE(mComposerClient->setVsync(getPrimaryDisplayId(), true).isOk());
usleep(60 * 1000);
- EXPECT_TRUE(mComposerClient->setVsyncEnabled(mPrimaryDisplay, false).isOk());
+ EXPECT_TRUE(mComposerClient->setVsync(getPrimaryDisplayId(), false).isOk());
- mComposerCallback->setVsyncAllowed(false);
+ mComposerClient->setVsyncAllowed(false);
}
TEST_P(GraphicsComposerAidlTest, SetPowerMode) {
- std::vector<DisplayCapability> capabilities;
- const auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
- ASSERT_TRUE(error.isOk());
+ const auto& [status, capabilities] =
+ mComposerClient->getDisplayCapabilities(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
+
const bool isDozeSupported = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::DOZE) != capabilities.end();
const bool isSuspendSupported = std::find(capabilities.begin(), capabilities.end(),
@@ -1097,14 +875,15 @@
}
for (auto mode : modes) {
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk());
}
}
TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
- std::vector<DisplayCapability> capabilities;
- const auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
- ASSERT_TRUE(error.isOk());
+ const auto& [status, capabilities] =
+ mComposerClient->getDisplayCapabilities(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
+
const bool isDozeSupported = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::DOZE) != capabilities.end();
const bool isSuspendSupported = std::find(capabilities.begin(), capabilities.end(),
@@ -1116,21 +895,21 @@
modes.push_back(PowerMode::ON);
modes.push_back(PowerMode::OFF);
for (auto mode : modes) {
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk());
}
modes.clear();
modes.push_back(PowerMode::OFF);
modes.push_back(PowerMode::OFF);
for (auto mode : modes) {
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk());
}
modes.clear();
modes.push_back(PowerMode::ON);
modes.push_back(PowerMode::ON);
for (auto mode : modes) {
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk());
}
modes.clear();
@@ -1138,7 +917,7 @@
modes.push_back(PowerMode::ON_SUSPEND);
modes.push_back(PowerMode::ON_SUSPEND);
for (auto mode : modes) {
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk());
}
modes.clear();
}
@@ -1147,7 +926,7 @@
modes.push_back(PowerMode::DOZE);
modes.push_back(PowerMode::DOZE);
for (auto mode : modes) {
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk());
}
modes.clear();
}
@@ -1156,46 +935,46 @@
modes.push_back(PowerMode::DOZE_SUSPEND);
modes.push_back(PowerMode::DOZE_SUSPEND);
for (auto mode : modes) {
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk());
}
modes.clear();
}
}
-TEST_P(GraphicsComposerAidlTest, SetPowerModeBadDisplay) {
- const auto error = mComposerClient->setPowerMode(mInvalidDisplayId, PowerMode::ON);
+TEST_P(GraphicsComposerAidlTest, SetPowerMode_BadDisplay) {
+ const auto& status = mComposerClient->setPowerMode(getInvalidDisplayId(), PowerMode::ON);
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlTest, SetPowerModeBadParameter) {
- const auto error = mComposerClient->setPowerMode(mPrimaryDisplay, static_cast<PowerMode>(-1));
+TEST_P(GraphicsComposerAidlTest, SetPowerMode_BadParameter) {
+ const auto& status =
+ mComposerClient->setPowerMode(getPrimaryDisplayId(), static_cast<PowerMode>(-1));
- EXPECT_FALSE(error.isOk());
- ASSERT_EQ(IComposerClient::EX_BAD_PARAMETER, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ ASSERT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
}
TEST_P(GraphicsComposerAidlTest, GetDataspaceSaturationMatrix) {
- std::vector<float> matrix;
- EXPECT_TRUE(
- mComposerClient->getDataspaceSaturationMatrix(common::Dataspace::SRGB_LINEAR, &matrix)
- .isOk());
+ const auto& [status, matrix] =
+ mComposerClient->getDataspaceSaturationMatrix(common::Dataspace::SRGB_LINEAR);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_EQ(16, matrix.size()); // matrix should not be empty if call succeeded.
// the last row is known
- ASSERT_EQ(0.0f, matrix[12]);
- ASSERT_EQ(0.0f, matrix[13]);
- ASSERT_EQ(0.0f, matrix[14]);
- ASSERT_EQ(1.0f, matrix[15]);
+ EXPECT_EQ(0.0f, matrix[12]);
+ EXPECT_EQ(0.0f, matrix[13]);
+ EXPECT_EQ(0.0f, matrix[14]);
+ EXPECT_EQ(1.0f, matrix[15]);
}
-TEST_P(GraphicsComposerAidlTest, GetDataspaceSaturationMatrixBadParameter) {
- std::vector<float> matrix;
- const auto error =
- mComposerClient->getDataspaceSaturationMatrix(common::Dataspace::UNKNOWN, &matrix);
+TEST_P(GraphicsComposerAidlTest, GetDataspaceSaturationMatrix_BadParameter) {
+ const auto& [status, matrix] =
+ mComposerClient->getDataspaceSaturationMatrix(common::Dataspace::UNKNOWN);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, error.getServiceSpecificError());
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
}
// Tests for Command.
@@ -1204,8 +983,7 @@
void TearDown() override {
const auto errors = mReader.takeErrors();
ASSERT_TRUE(mReader.takeErrors().empty());
- ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
- ASSERT_TRUE(mReader.takeBufferAheadResultLayers(mPrimaryDisplay).empty());
+ ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
ASSERT_NO_FATAL_FAILURE(GraphicsComposerAidlTest::TearDown());
}
@@ -1217,8 +995,7 @@
return;
}
- std::vector<CommandResultPayload> results;
- const auto status = mComposerClient->executeCommands(commands, &results);
+ auto [status, results] = mComposerClient->executeCommands(commands);
ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription();
mReader.parse(std::move(results));
@@ -1229,24 +1006,9 @@
return std::chrono::time_point<std::chrono::steady_clock>(std::chrono::nanoseconds(time));
}
- void setActiveConfig(VtsDisplay& display, int32_t config) {
- EXPECT_TRUE(mComposerClient->setActiveConfig(display.get(), config).isOk());
- int32_t displayWidth;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config, DisplayAttribute::WIDTH,
- &displayWidth)
- .isOk());
- int32_t displayHeight;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config, DisplayAttribute::HEIGHT,
- &displayHeight)
- .isOk());
- display.setDimensions(displayWidth, displayHeight);
- }
-
void forEachTwoConfigs(int64_t display, std::function<void(int32_t, int32_t)> func) {
- std::vector<int32_t> displayConfigs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(display, &displayConfigs).isOk());
+ const auto& [status, displayConfigs] = mComposerClient->getDisplayConfigs(display);
+ ASSERT_TRUE(status.isOk());
for (const int32_t config1 : displayConfigs) {
for (const int32_t config2 : displayConfigs) {
if (config1 != config2) {
@@ -1261,8 +1023,9 @@
int64_t newPeriodNanos) {
const auto kChangeDeadline = toTimePoint(timeline.newVsyncAppliedTimeNanos) + 100ms;
while (std::chrono::steady_clock::now() <= kChangeDeadline) {
- int32_t vsyncPeriodNanos;
- EXPECT_TRUE(mComposerClient->getDisplayVsyncPeriod(display, &vsyncPeriodNanos).isOk());
+ const auto& [status, vsyncPeriodNanos] =
+ mComposerClient->getDisplayVsyncPeriod(display);
+ EXPECT_TRUE(status.isOk());
if (systemTime() <= desiredTimeNanos) {
EXPECT_EQ(vsyncPeriodNanos, oldPeriodNanos);
} else if (vsyncPeriodNanos == newPeriodNanos) {
@@ -1274,9 +1037,10 @@
sp<GraphicBuffer> allocate() {
return sp<GraphicBuffer>::make(
- static_cast<uint32_t>(mDisplayWidth), static_cast<uint32_t>(mDisplayHeight),
+ static_cast<uint32_t>(getPrimaryDisplay().getDisplayWidth()),
+ static_cast<uint32_t>(getPrimaryDisplay().getDisplayHeight()),
::android::PIXEL_FORMAT_RGBA_8888,
- /*layerCount*/ 1,
+ /*layerCount*/ 1U,
(static_cast<uint64_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
static_cast<uint64_t>(common::BufferUsage::CPU_READ_OFTEN) |
static_cast<uint64_t>(common::BufferUsage::COMPOSER_OVERLAY)),
@@ -1291,39 +1055,32 @@
std::this_thread::sleep_until(toTimePoint(timeline->refreshTimeNanos));
}
- EXPECT_TRUE(mComposerClient->setPowerMode(display.get(), PowerMode::ON).isOk());
- EXPECT_TRUE(
- mComposerClient
- ->setColorMode(display.get(), ColorMode::NATIVE, RenderIntent::COLORIMETRIC)
- .isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(display.getDisplayId(), PowerMode::ON).isOk());
+ EXPECT_TRUE(mComposerClient
+ ->setColorMode(display.getDisplayId(), ColorMode::NATIVE,
+ RenderIntent::COLORIMETRIC)
+ .isOk());
- int64_t layer = 0;
- ASSERT_NO_FATAL_FAILURE(layer = createLayer(display));
+ const auto& [status, layer] =
+ mComposerClient->createLayer(display.getDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(status.isOk());
{
const auto buffer = allocate();
ASSERT_NE(nullptr, buffer);
ASSERT_EQ(::android::OK, buffer->initCheck());
ASSERT_NE(nullptr, buffer->handle);
- mWriter.setLayerCompositionType(display.get(), layer, Composition::DEVICE);
- mWriter.setLayerDisplayFrame(display.get(), layer, display.getFrameRect());
- mWriter.setLayerPlaneAlpha(display.get(), layer, 1);
- mWriter.setLayerSourceCrop(display.get(), layer, display.getCrop());
- mWriter.setLayerTransform(display.get(), layer, static_cast<Transform>(0));
- mWriter.setLayerVisibleRegion(display.get(), layer,
- std::vector<Rect>(1, display.getFrameRect()));
- mWriter.setLayerZOrder(display.get(), layer, 10);
- mWriter.setLayerBlendMode(display.get(), layer, BlendMode::NONE);
- mWriter.setLayerSurfaceDamage(display.get(), layer,
- std::vector<Rect>(1, display.getFrameRect()));
- mWriter.setLayerBuffer(display.get(), layer, 0, buffer->handle, -1);
- mWriter.setLayerDataspace(display.get(), layer, common::Dataspace::UNKNOWN);
+ 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);
- mWriter.validateDisplay(display.get(), ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(display.get());
+ mWriter.presentDisplay(display.getDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
@@ -1332,31 +1089,32 @@
const auto buffer = allocate();
ASSERT_NE(nullptr, buffer->handle);
- mWriter.setLayerBuffer(display.get(), layer, 0, buffer->handle, -1);
- mWriter.setLayerSurfaceDamage(display.get(), layer,
+ mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, buffer->handle,
+ /*acquireFence*/ -1);
+ mWriter.setLayerSurfaceDamage(display.getDisplayId(), layer,
std::vector<Rect>(1, {0, 0, 10, 10}));
- mWriter.validateDisplay(display.get(), ComposerClientWriter::kNoTimestamp);
+ mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(display.get());
+ mWriter.presentDisplay(display.getDisplayId());
execute();
}
- ASSERT_NO_FATAL_FAILURE(destroyLayer(display, layer));
+ EXPECT_TRUE(mComposerClient->destroyLayer(display.getDisplayId(), layer).isOk());
}
sp<::android::Fence> presentAndGetFence(
std::optional<ClockMonotonicTimestamp> expectedPresentTime) {
- mWriter.validateDisplay(mPrimaryDisplay, expectedPresentTime);
+ mWriter.validateDisplay(getPrimaryDisplayId(), expectedPresentTime);
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
- auto presentFence = mReader.takePresentFence(mPrimaryDisplay);
+ auto presentFence = mReader.takePresentFence(getPrimaryDisplayId());
// take ownership
const int fenceOwner = presentFence.get();
*presentFence.getR() = -1;
@@ -1365,74 +1123,49 @@
}
int32_t getVsyncPeriod() {
- int32_t activeConfig;
- EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &activeConfig).isOk());
+ const auto& [status, activeConfig] =
+ mComposerClient->getActiveConfig(getPrimaryDisplayId());
+ EXPECT_TRUE(status.isOk());
- int32_t vsyncPeriod;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(mPrimaryDisplay, activeConfig,
- DisplayAttribute::VSYNC_PERIOD, &vsyncPeriod)
- .isOk());
+ const auto& [vsyncPeriodStatus, vsyncPeriod] = mComposerClient->getDisplayAttribute(
+ getPrimaryDisplayId(), activeConfig, DisplayAttribute::VSYNC_PERIOD);
+ EXPECT_TRUE(vsyncPeriodStatus.isOk());
return vsyncPeriod;
}
int64_t createOnScreenLayer() {
- const int64_t layer = createLayer(mDisplays[0]);
- mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::DEVICE);
- mWriter.setLayerDisplayFrame(mPrimaryDisplay, layer, {0, 0, mDisplayWidth, mDisplayHeight});
- mWriter.setLayerPlaneAlpha(mPrimaryDisplay, layer, 1);
- mWriter.setLayerSourceCrop(
- mPrimaryDisplay, layer,
- {0, 0, static_cast<float>(mDisplayWidth), static_cast<float>(mDisplayHeight)});
- mWriter.setLayerTransform(mPrimaryDisplay, layer, static_cast<Transform>(0));
- mWriter.setLayerVisibleRegion(mPrimaryDisplay, layer,
- std::vector<Rect>(1, {0, 0, mDisplayWidth, mDisplayHeight}));
- mWriter.setLayerZOrder(mPrimaryDisplay, layer, 10);
- mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::NONE);
- mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer,
- std::vector<Rect>(1, {0, 0, mDisplayWidth, mDisplayHeight}));
- mWriter.setLayerDataspace(mPrimaryDisplay, layer, common::Dataspace::UNKNOWN);
+ const auto& [status, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(status.isOk());
+ Rect displayFrame{0, 0, getPrimaryDisplay().getDisplayWidth(),
+ getPrimaryDisplay().getDisplayHeight()};
+ FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(),
+ (float)getPrimaryDisplay().getDisplayHeight()};
+ configureLayer(getPrimaryDisplay(), layer, Composition::DEVICE, displayFrame, cropRect);
+ mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, common::Dataspace::UNKNOWN);
return layer;
}
bool hasDisplayCapability(int64_t display, DisplayCapability cap) {
- std::vector<DisplayCapability> capabilities;
- const auto error = mComposerClient->getDisplayCapabilities(display, &capabilities);
- EXPECT_TRUE(error.isOk());
+ const auto& [status, capabilities] = mComposerClient->getDisplayCapabilities(display);
+ EXPECT_TRUE(status.isOk());
return std::find(capabilities.begin(), capabilities.end(), cap) != capabilities.end();
}
void Test_setActiveConfigWithConstraints(const TestParameters& params) {
for (VtsDisplay& display : mDisplays) {
- forEachTwoConfigs(display.get(), [&](int32_t config1, int32_t config2) {
- setActiveConfig(display, config1);
+ forEachTwoConfigs(display.getDisplayId(), [&](int32_t config1, int32_t config2) {
+ EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk());
sendRefreshFrame(display, nullptr);
- int32_t vsyncPeriod1;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config1,
- DisplayAttribute::VSYNC_PERIOD,
- &vsyncPeriod1)
- .isOk());
- int32_t configGroup1;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config1,
- DisplayAttribute::CONFIG_GROUP,
- &configGroup1)
- .isOk());
- int32_t vsyncPeriod2;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config2,
- DisplayAttribute::VSYNC_PERIOD,
- &vsyncPeriod2)
- .isOk());
- int32_t configGroup2;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config2,
- DisplayAttribute::CONFIG_GROUP,
- &configGroup2)
- .isOk());
+ const auto displayConfigGroup1 = display.getDisplayConfig(config1);
+ int32_t vsyncPeriod1 = displayConfigGroup1.vsyncPeriod;
+ int32_t configGroup1 = displayConfigGroup1.configGroup;
+
+ const auto displayConfigGroup2 = display.getDisplayConfig(config2);
+ int32_t vsyncPeriod2 = displayConfigGroup2.vsyncPeriod;
+ int32_t configGroup2 = displayConfigGroup2.configGroup;
if (vsyncPeriod1 == vsyncPeriod2) {
return; // continue
@@ -1443,12 +1176,12 @@
return; // continue
}
- VsyncPeriodChangeTimeline timeline;
VsyncPeriodChangeConstraints constraints = {
.desiredTimeNanos = systemTime() + params.delayForChange,
.seamlessRequired = false};
- EXPECT_TRUE(setActiveConfigWithConstraints(display, config2, constraints, &timeline)
- .isOk());
+ const auto& [status, timeline] = mComposerClient->setActiveConfigWithConstraints(
+ &display, config2, constraints);
+ EXPECT_TRUE(status.isOk());
EXPECT_TRUE(timeline.newVsyncAppliedTimeNanos >= constraints.desiredTimeNanos);
// Refresh rate should change within a reasonable time
@@ -1465,13 +1198,13 @@
}
sendRefreshFrame(display, &timeline);
}
- waitForVsyncPeriodChange(display.get(), timeline, constraints.desiredTimeNanos,
- vsyncPeriod1, vsyncPeriod2);
+ waitForVsyncPeriodChange(display.getDisplayId(), timeline,
+ constraints.desiredTimeNanos, vsyncPeriod1, vsyncPeriod2);
// At this point the refresh rate should have changed already, however in rare
// cases the implementation might have missed the deadline. In this case a new
// timeline should have been provided.
- auto newTimeline = mComposerCallback->takeLastVsyncPeriodChangeTimeline();
+ auto newTimeline = mComposerClient->takeLastVsyncPeriodChangeTimeline();
if (timeline.refreshRequired && params.refreshMiss) {
EXPECT_TRUE(newTimeline.has_value());
}
@@ -1480,14 +1213,14 @@
if (newTimeline->refreshRequired) {
sendRefreshFrame(display, &newTimeline.value());
}
- waitForVsyncPeriodChange(display.get(), newTimeline.value(),
+ waitForVsyncPeriodChange(display.getDisplayId(), newTimeline.value(),
constraints.desiredTimeNanos, vsyncPeriod1,
vsyncPeriod2);
}
- int32_t vsyncPeriodNanos;
- EXPECT_TRUE(mComposerClient->getDisplayVsyncPeriod(display.get(), &vsyncPeriodNanos)
- .isOk());
+ const auto& [vsyncPeriodNanosStatus, vsyncPeriodNanos] =
+ mComposerClient->getDisplayVsyncPeriod(display.getDisplayId());
+ EXPECT_TRUE(vsyncPeriodNanosStatus.isOk());
EXPECT_EQ(vsyncPeriodNanos, vsyncPeriod2);
});
}
@@ -1499,7 +1232,7 @@
return;
}
- ASSERT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON).isOk());
+ ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk());
const auto vsyncPeriod = getVsyncPeriod();
@@ -1509,7 +1242,8 @@
ASSERT_NE(nullptr, buffer2);
const auto layer = createOnScreenLayer();
- mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, buffer1->handle, -1);
+ mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer1->handle,
+ /*acquireFence*/ -1);
const sp<::android::Fence> presentFence1 =
presentAndGetFence(ComposerClientWriter::kNoTimestamp);
presentFence1->waitForever(LOG_TAG);
@@ -1519,7 +1253,8 @@
expectedPresentTime += *framesDelay * vsyncPeriod;
}
- mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, buffer2->handle, -1);
+ mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer2->handle,
+ /*acquireFence*/ -1);
const auto setExpectedPresentTime = [&]() -> std::optional<ClockMonotonicTimestamp> {
if (!framesDelay.has_value()) {
return ComposerClientWriter::kNoTimestamp;
@@ -1535,9 +1270,23 @@
const auto actualPresentTime = presentFence2->getSignalTime();
EXPECT_GE(actualPresentTime, expectedPresentTime - vsyncPeriod / 2);
- ASSERT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF).isOk());
+ ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
}
+ 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<Transform>(0));
+ mWriter.setLayerVisibleRegion(display.getDisplayId(), layer,
+ std::vector<Rect>(1, displayFrame));
+ mWriter.setLayerZOrder(display.getDisplayId(), layer, /*z*/ 10);
+ mWriter.setLayerBlendMode(display.getDisplayId(), layer, BlendMode::NONE);
+ mWriter.setLayerSurfaceDamage(display.getDisplayId(), layer,
+ std::vector<Rect>(1, displayFrame));
+ }
// clang-format off
const std::array<float, 16> kIdentity = {{
1.0f, 0.0f, 0.0f, 0.0f,
@@ -1551,15 +1300,16 @@
ComposerClientReader mReader;
};
-TEST_P(GraphicsComposerAidlCommandTest, SET_COLOR_TRANSFORM) {
- mWriter.setColorTransform(mPrimaryDisplay, kIdentity.data());
+TEST_P(GraphicsComposerAidlCommandTest, SetColorTransform) {
+ mWriter.setColorTransform(getPrimaryDisplayId(), kIdentity.data());
execute();
}
TEST_P(GraphicsComposerAidlCommandTest, SetLayerColorTransform) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
- mWriter.setLayerColorTransform(mPrimaryDisplay, layer, kIdentity.data());
+ const auto& [status, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(status.isOk());
+ mWriter.setLayerColorTransform(getPrimaryDisplayId(), layer, kIdentity.data());
execute();
const auto errors = mReader.takeErrors();
@@ -1570,13 +1320,13 @@
}
TEST_P(GraphicsComposerAidlCommandTest, SetDisplayBrightness) {
- std::vector<DisplayCapability> capabilities;
- auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
- ASSERT_TRUE(error.isOk());
+ const auto& [status, capabilities] =
+ mComposerClient->getDisplayCapabilities(getPrimaryDisplayId());
+ ASSERT_TRUE(status.isOk());
bool brightnessSupport = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::BRIGHTNESS) != capabilities.end();
if (!brightnessSupport) {
- mWriter.setDisplayBrightness(mPrimaryDisplay, 0.5f);
+ mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.5f);
execute();
const auto errors = mReader.takeErrors();
EXPECT_EQ(1, errors.size());
@@ -1585,23 +1335,23 @@
return;
}
- mWriter.setDisplayBrightness(mPrimaryDisplay, 0.0f);
+ mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.0f);
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
- mWriter.setDisplayBrightness(mPrimaryDisplay, 0.5f);
+ mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.5f);
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
- mWriter.setDisplayBrightness(mPrimaryDisplay, 1.0f);
+ mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.0f);
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
- mWriter.setDisplayBrightness(mPrimaryDisplay, -1.0f);
+ mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ -1.0f);
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
- mWriter.setDisplayBrightness(mPrimaryDisplay, 2.0f);
+ mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 2.0f);
execute();
{
const auto errors = mReader.takeErrors();
@@ -1609,7 +1359,7 @@
EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode);
}
- mWriter.setDisplayBrightness(mPrimaryDisplay, -2.0f);
+ mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ -2.0f);
execute();
{
const auto errors = mReader.takeErrors();
@@ -1618,51 +1368,49 @@
}
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_CLIENT_TARGET) {
- EXPECT_TRUE(
- mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kBufferSlotCount).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetClientTarget) {
+ EXPECT_TRUE(mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kBufferSlotCount)
+ .isOk());
- mWriter.setClientTarget(mPrimaryDisplay, 0, nullptr, -1, Dataspace::UNKNOWN,
- std::vector<Rect>());
+ mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, nullptr, /*acquireFence*/ -1,
+ Dataspace::UNKNOWN, std::vector<Rect>());
execute();
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_OUTPUT_BUFFER) {
- int32_t virtualDisplayCount;
- EXPECT_TRUE(mComposerClient->getMaxVirtualDisplayCount(&virtualDisplayCount).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetOutputBuffer) {
+ const auto& [status, virtualDisplayCount] = mComposerClient->getMaxVirtualDisplayCount();
+ EXPECT_TRUE(status.isOk());
if (virtualDisplayCount == 0) {
GTEST_SUCCEED() << "no virtual display support";
return;
}
- VirtualDisplay display;
- EXPECT_TRUE(mComposerClient
- ->createVirtualDisplay(64, 64, common::PixelFormat::IMPLEMENTATION_DEFINED,
- kBufferSlotCount, &display)
- .isOk());
+ const auto& [displayStatus, display] = mComposerClient->createVirtualDisplay(
+ /*width*/ 64, /*height*/ 64, common::PixelFormat::IMPLEMENTATION_DEFINED,
+ kBufferSlotCount);
+ EXPECT_TRUE(displayStatus.isOk());
const auto buffer = allocate();
const auto handle = buffer->handle;
- mWriter.setOutputBuffer(display.display, 0, handle, -1);
+ mWriter.setOutputBuffer(display.display, /*slot*/ 0, handle, /*releaseFence*/ -1);
execute();
}
-TEST_P(GraphicsComposerAidlCommandTest, VALIDATE_DISPLAY) {
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+TEST_P(GraphicsComposerAidlCommandTest, ValidDisplay) {
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
}
-TEST_P(GraphicsComposerAidlCommandTest, ACCEPT_DISPLAY_CHANGES) {
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
- mWriter.acceptDisplayChanges(mPrimaryDisplay);
+TEST_P(GraphicsComposerAidlCommandTest, AcceptDisplayChanges) {
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
+ mWriter.acceptDisplayChanges(getPrimaryDisplayId());
execute();
}
-// TODO(b/208441745) fix the test failure
-TEST_P(GraphicsComposerAidlCommandTest, PRESENT_DISPLAY) {
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
- mWriter.presentDisplay(mPrimaryDisplay);
+TEST_P(GraphicsComposerAidlCommandTest, PresentDisplay) {
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
}
@@ -1673,236 +1421,237 @@
* additional call to validateDisplay when only the layer buffer handle and
* surface damage have been set
*/
-// TODO(b/208441745) fix the test failure
-TEST_P(GraphicsComposerAidlCommandTest, PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES) {
+TEST_P(GraphicsComposerAidlCommandTest, PresentDisplayNoLayerStateChanges) {
if (!hasCapability(Capability::SKIP_VALIDATE)) {
GTEST_SUCCEED() << "Device does not have skip validate capability, skipping";
return;
}
- mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON);
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk());
- std::vector<RenderIntent> renderIntents;
- mComposerClient->getRenderIntents(mPrimaryDisplay, ColorMode::NATIVE, &renderIntents);
+ const auto& [renderIntentsStatus, renderIntents] =
+ mComposerClient->getRenderIntents(getPrimaryDisplayId(), ColorMode::NATIVE);
+ EXPECT_TRUE(renderIntentsStatus.isOk());
for (auto intent : renderIntents) {
- mComposerClient->setColorMode(mPrimaryDisplay, ColorMode::NATIVE, intent);
+ EXPECT_TRUE(mComposerClient->setColorMode(getPrimaryDisplayId(), ColorMode::NATIVE, intent)
+ .isOk());
const auto buffer = allocate();
const auto handle = buffer->handle;
ASSERT_NE(nullptr, handle);
- Rect displayFrame{0, 0, mDisplayWidth, mDisplayHeight};
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
- mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::DEVICE);
- mWriter.setLayerDisplayFrame(mPrimaryDisplay, layer, displayFrame);
- mWriter.setLayerPlaneAlpha(mPrimaryDisplay, layer, 1);
- mWriter.setLayerSourceCrop(mPrimaryDisplay, layer,
- {0, 0, (float)mDisplayWidth, (float)mDisplayHeight});
- mWriter.setLayerTransform(mPrimaryDisplay, layer, static_cast<Transform>(0));
- mWriter.setLayerVisibleRegion(mPrimaryDisplay, layer, std::vector<Rect>(1, displayFrame));
- mWriter.setLayerZOrder(mPrimaryDisplay, layer, 10);
- mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::NONE);
- mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer, std::vector<Rect>(1, displayFrame));
- mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, handle, -1);
- mWriter.setLayerDataspace(mPrimaryDisplay, layer, Dataspace::UNKNOWN);
-
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ 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.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle,
+ /*acquireFence*/ -1);
+ mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED() << "Composition change requested, skipping test";
return;
}
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
const auto buffer2 = allocate();
const auto handle2 = buffer2->handle;
ASSERT_NE(nullptr, handle2);
- mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, handle2, -1);
- mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer, std::vector<Rect>(1, {0, 0, 10, 10}));
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2,
+ /*acquireFence*/ -1);
+ mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer,
+ std::vector<Rect>(1, {0, 0, 10, 10}));
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
}
}
-// TODO(b/208441745) fix the test failure
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_CURSOR_POSITION) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerCursorPosition) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
const auto buffer = allocate();
const auto handle = buffer->handle;
ASSERT_NE(nullptr, handle);
- Rect displayFrame{0, 0, mDisplayWidth, mDisplayHeight};
- mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, handle, -1);
- mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::CURSOR);
- mWriter.setLayerDisplayFrame(mPrimaryDisplay, layer, displayFrame);
- mWriter.setLayerPlaneAlpha(mPrimaryDisplay, layer, 1);
- mWriter.setLayerSourceCrop(mPrimaryDisplay, layer,
- {0, 0, (float)mDisplayWidth, (float)mDisplayHeight});
- mWriter.setLayerTransform(mPrimaryDisplay, layer, static_cast<Transform>(0));
- mWriter.setLayerVisibleRegion(mPrimaryDisplay, layer, std::vector<Rect>(1, displayFrame));
- mWriter.setLayerZOrder(mPrimaryDisplay, layer, 10);
- mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::NONE);
- mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer, std::vector<Rect>(1, displayFrame));
- mWriter.setLayerDataspace(mPrimaryDisplay, layer, Dataspace::UNKNOWN);
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+ mWriter.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);
execute();
- if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+ if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
GTEST_SUCCEED() << "Composition change requested, skipping test";
return;
}
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.presentDisplay(getPrimaryDisplayId());
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerCursorPosition(mPrimaryDisplay, layer, 1, 1);
+ mWriter.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 1, /*y*/ 1);
execute();
- mWriter.setLayerCursorPosition(mPrimaryDisplay, layer, 0, 0);
- mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
- mWriter.presentDisplay(mPrimaryDisplay);
+ mWriter.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 0, /*y*/ 0);
+ mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
+ mWriter.presentDisplay(getPrimaryDisplayId());
execute();
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_BUFFER) {
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) {
const auto buffer = allocate();
const auto handle = buffer->handle;
ASSERT_NE(nullptr, handle);
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
- mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, handle, -1);
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
+ mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, /*acquireFence*/ -1);
execute();
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_SURFACE_DAMAGE) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerSurfaceDamage) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
Rect empty{0, 0, 0, 0};
Rect unit{0, 0, 1, 1};
- mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer, std::vector<Rect>(1, empty));
+ mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector<Rect>(1, empty));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer, std::vector<Rect>(1, unit));
+ mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector<Rect>(1, unit));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer, std::vector<Rect>());
+ mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector<Rect>());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_BLOCKING_REGION) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerBlockingRegion) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
Rect empty{0, 0, 0, 0};
Rect unit{0, 0, 1, 1};
- mWriter.setLayerBlockingRegion(mPrimaryDisplay, layer, std::vector<Rect>(1, empty));
+ mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector<Rect>(1, empty));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerBlockingRegion(mPrimaryDisplay, layer, std::vector<Rect>(1, unit));
+ mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector<Rect>(1, unit));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerBlockingRegion(mPrimaryDisplay, layer, std::vector<Rect>());
+ mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector<Rect>());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_BLEND_MODE) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerBlendMode) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
- mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::NONE);
+ mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::NONE);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::PREMULTIPLIED);
+ mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::PREMULTIPLIED);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::COVERAGE);
+ mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::COVERAGE);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_COLOR) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerColor) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
- mWriter.setLayerColor(mPrimaryDisplay, layer, Color{1.0f, 1.0f, 1.0f, 1.0f});
+ mWriter.setLayerColor(getPrimaryDisplayId(), layer, Color{1.0f, 1.0f, 1.0f, 1.0f});
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerColor(mPrimaryDisplay, layer, Color{0.0f, 0.0f, 0.0f, 0.0f});
+ mWriter.setLayerColor(getPrimaryDisplayId(), layer, Color{0.0f, 0.0f, 0.0f, 0.0f});
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_COMPOSITION_TYPE) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerCompositionType) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
- mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::CLIENT);
+ mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::CLIENT);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::DEVICE);
+ mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::DEVICE);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::SOLID_COLOR);
+ mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::SOLID_COLOR);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::CURSOR);
+ mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::CURSOR);
+ execute();
+}
+
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerDataspace) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
+
+ mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN);
+ execute();
+}
+
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerDisplayFrame) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
+
+ mWriter.setLayerDisplayFrame(getPrimaryDisplayId(), layer, Rect{0, 0, 1, 1});
+ execute();
+}
+
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerPlaneAlpha) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
+
+ mWriter.setLayerPlaneAlpha(getPrimaryDisplayId(), layer, /*alpha*/ 0.0f);
+ execute();
+ ASSERT_TRUE(mReader.takeErrors().empty());
+
+ mWriter.setLayerPlaneAlpha(getPrimaryDisplayId(), layer, /*alpha*/ 1.0f);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_DATASPACE) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
-
- mWriter.setLayerDataspace(mPrimaryDisplay, layer, Dataspace::UNKNOWN);
- execute();
-}
-
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_DISPLAY_FRAME) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
-
- mWriter.setLayerDisplayFrame(mPrimaryDisplay, layer, Rect{0, 0, 1, 1});
- execute();
-}
-
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_PLANE_ALPHA) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
-
- mWriter.setLayerPlaneAlpha(mPrimaryDisplay, layer, 0.0f);
- execute();
- ASSERT_TRUE(mReader.takeErrors().empty());
-
- mWriter.setLayerPlaneAlpha(mPrimaryDisplay, layer, 1.0f);
- execute();
- ASSERT_TRUE(mReader.takeErrors().empty());
-}
-
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_SIDEBAND_STREAM) {
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerSidebandStream) {
if (!hasCapability(Capability::SIDEBAND_STREAM)) {
GTEST_SUCCEED() << "no sideband stream support";
return;
@@ -1912,98 +1661,104 @@
const auto handle = buffer->handle;
ASSERT_NE(nullptr, handle);
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
- mWriter.setLayerSidebandStream(mPrimaryDisplay, layer, handle);
+ mWriter.setLayerSidebandStream(getPrimaryDisplayId(), layer, handle);
execute();
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_SOURCE_CROP) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerSourceCrop) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
- mWriter.setLayerSourceCrop(mPrimaryDisplay, layer, FRect{0.0f, 0.0f, 1.0f, 1.0f});
+ mWriter.setLayerSourceCrop(getPrimaryDisplayId(), layer, FRect{0.0f, 0.0f, 1.0f, 1.0f});
execute();
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_TRANSFORM) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerTransform) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
- mWriter.setLayerTransform(mPrimaryDisplay, layer, static_cast<Transform>(0));
+ mWriter.setLayerTransform(getPrimaryDisplayId(), layer, static_cast<Transform>(0));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerTransform(mPrimaryDisplay, layer, Transform::FLIP_H);
+ mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::FLIP_H);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerTransform(mPrimaryDisplay, layer, Transform::FLIP_V);
+ mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::FLIP_V);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerTransform(mPrimaryDisplay, layer, Transform::ROT_90);
+ mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_90);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerTransform(mPrimaryDisplay, layer, Transform::ROT_180);
+ mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_180);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerTransform(mPrimaryDisplay, layer, Transform::ROT_270);
+ mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_270);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerTransform(mPrimaryDisplay, layer,
+ mWriter.setLayerTransform(getPrimaryDisplayId(), layer,
static_cast<Transform>(static_cast<int>(Transform::FLIP_H) |
static_cast<int>(Transform::ROT_90)));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerTransform(mPrimaryDisplay, layer,
+ mWriter.setLayerTransform(getPrimaryDisplayId(), layer,
static_cast<Transform>(static_cast<int>(Transform::FLIP_V) |
static_cast<int>(Transform::ROT_90)));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_VISIBLE_REGION) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerVisibleRegion) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
Rect empty{0, 0, 0, 0};
Rect unit{0, 0, 1, 1};
- mWriter.setLayerVisibleRegion(mPrimaryDisplay, layer, std::vector<Rect>(1, empty));
+ mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector<Rect>(1, empty));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerVisibleRegion(mPrimaryDisplay, layer, std::vector<Rect>(1, unit));
+ mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector<Rect>(1, unit));
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerVisibleRegion(mPrimaryDisplay, layer, std::vector<Rect>());
+ mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector<Rect>());
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_Z_ORDER) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerZOrder) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
- mWriter.setLayerZOrder(mPrimaryDisplay, layer, 10);
+ mWriter.setLayerZOrder(getPrimaryDisplayId(), layer, /*z*/ 10);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerZOrder(mPrimaryDisplay, layer, 0);
+ mWriter.setLayerZOrder(getPrimaryDisplayId(), layer, /*z*/ 0);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
}
-TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_PER_FRAME_METADATA) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, SetLayerPerFrameMetadata) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
+ EXPECT_TRUE(layerStatus.isOk());
/**
* DISPLAY_P3 is a color space that uses the DCI_P3 primaries,
@@ -2030,88 +1785,97 @@
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(mPrimaryDisplay, layer, aidlMetadata);
+ mWriter.setLayerPerFrameMetadata(getPrimaryDisplayId(), layer, aidlMetadata);
execute();
const auto errors = mReader.takeErrors();
if (errors.size() == 1 && errors[0].errorCode == EX_UNSUPPORTED_OPERATION) {
GTEST_SUCCEED() << "SetLayerPerFrameMetadata is not supported";
- EXPECT_TRUE(mComposerClient->destroyLayer(mPrimaryDisplay, layer).isOk());
+ EXPECT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer).isOk());
return;
}
- EXPECT_TRUE(mComposerClient->destroyLayer(mPrimaryDisplay, layer).isOk());
+ EXPECT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer).isOk());
}
-TEST_P(GraphicsComposerAidlCommandTest, setLayerWhitePointNits) {
- int64_t layer;
- EXPECT_TRUE(mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount, &layer).isOk());
+TEST_P(GraphicsComposerAidlCommandTest, setLayerBrightness) {
+ const auto& [layerStatus, layer] =
+ mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
- mWriter.setLayerWhitePointNits(mPrimaryDisplay, layer, 200.f);
+ mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 0.2f);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerWhitePointNits(mPrimaryDisplay, layer, 1000.f);
+ mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 1.f);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerWhitePointNits(mPrimaryDisplay, layer, 0.f);
+ mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 0.f);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.setLayerWhitePointNits(mPrimaryDisplay, layer, -1.f);
+ mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, -1.f);
execute();
- ASSERT_TRUE(mReader.takeErrors().empty());
+ {
+ const auto errors = mReader.takeErrors();
+ ASSERT_EQ(1, errors.size());
+ EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode);
+ }
+
+ mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, std::nanf(""));
+ execute();
+ {
+ const auto errors = mReader.takeErrors();
+ ASSERT_EQ(1, errors.size());
+ EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode);
+ }
}
-TEST_P(GraphicsComposerAidlCommandTest, setActiveConfigWithConstraints) {
+TEST_P(GraphicsComposerAidlCommandTest, SetActiveConfigWithConstraints) {
Test_setActiveConfigWithConstraints({.delayForChange = 0, .refreshMiss = false});
}
-TEST_P(GraphicsComposerAidlCommandTest, setActiveConfigWithConstraints_Delayed) {
+TEST_P(GraphicsComposerAidlCommandTest, SetActiveConfigWithConstraints_Delayed) {
Test_setActiveConfigWithConstraints({.delayForChange = 300'000'000, // 300ms
.refreshMiss = false});
}
-TEST_P(GraphicsComposerAidlCommandTest, setActiveConfigWithConstraints_MissRefresh) {
+TEST_P(GraphicsComposerAidlCommandTest, SetActiveConfigWithConstraints_MissRefresh) {
Test_setActiveConfigWithConstraints({.delayForChange = 0, .refreshMiss = true});
}
-TEST_P(GraphicsComposerAidlCommandTest, getDisplayVsyncPeriod) {
+TEST_P(GraphicsComposerAidlCommandTest, GetDisplayVsyncPeriod) {
for (VtsDisplay& display : mDisplays) {
- std::vector<int32_t> configs;
- EXPECT_TRUE(mComposerClient->getDisplayConfigs(display.get(), &configs).isOk());
- for (int32_t config : configs) {
- int32_t expectedVsyncPeriodNanos = -1;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config,
- DisplayAttribute::VSYNC_PERIOD,
- &expectedVsyncPeriodNanos)
- .isOk());
+ const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId());
+ EXPECT_TRUE(status.isOk());
- VsyncPeriodChangeTimeline timeline;
+ for (int32_t config : configs) {
+ int32_t expectedVsyncPeriodNanos = display.getDisplayConfig(config).vsyncPeriod;
+
VsyncPeriodChangeConstraints constraints;
constraints.desiredTimeNanos = systemTime();
constraints.seamlessRequired = false;
- EXPECT_TRUE(mComposerClient
- ->setActiveConfigWithConstraints(display.get(), config, constraints,
- &timeline)
- .isOk());
+
+ const auto& [timelineStatus, timeline] =
+ mComposerClient->setActiveConfigWithConstraints(&display, config, constraints);
+ EXPECT_TRUE(timelineStatus.isOk());
if (timeline.refreshRequired) {
sendRefreshFrame(display, &timeline);
}
- waitForVsyncPeriodChange(display.get(), timeline, constraints.desiredTimeNanos, 0,
- expectedVsyncPeriodNanos);
+ waitForVsyncPeriodChange(display.getDisplayId(), timeline, constraints.desiredTimeNanos,
+ /*odPeriodNanos*/ 0, expectedVsyncPeriodNanos);
int32_t vsyncPeriodNanos;
int retryCount = 100;
do {
std::this_thread::sleep_for(10ms);
- vsyncPeriodNanos = 0;
- EXPECT_TRUE(mComposerClient->getDisplayVsyncPeriod(display.get(), &vsyncPeriodNanos)
- .isOk());
+ const auto& [vsyncPeriodNanosStatus, vsyncPeriodNanosValue] =
+ mComposerClient->getDisplayVsyncPeriod(display.getDisplayId());
+
+ EXPECT_TRUE(vsyncPeriodNanosStatus.isOk());
+ vsyncPeriodNanos = vsyncPeriodNanosValue;
--retryCount;
} while (vsyncPeriodNanos != expectedVsyncPeriodNanos && retryCount > 0);
@@ -2124,122 +1888,121 @@
std::this_thread::sleep_for(timeout);
timeout *= 2;
vsyncPeriodNanos = 0;
- EXPECT_TRUE(mComposerClient->getDisplayVsyncPeriod(display.get(), &vsyncPeriodNanos)
- .isOk());
+ const auto& [vsyncPeriodNanosStatus, vsyncPeriodNanosValue] =
+ mComposerClient->getDisplayVsyncPeriod(display.getDisplayId());
+
+ EXPECT_TRUE(vsyncPeriodNanosStatus.isOk());
+ vsyncPeriodNanos = vsyncPeriodNanosValue;
EXPECT_EQ(vsyncPeriodNanos, expectedVsyncPeriodNanos);
}
}
}
}
-TEST_P(GraphicsComposerAidlCommandTest, setActiveConfigWithConstraints_SeamlessNotAllowed) {
- VsyncPeriodChangeTimeline timeline;
+TEST_P(GraphicsComposerAidlCommandTest, SetActiveConfigWithConstraints_SeamlessNotAllowed) {
VsyncPeriodChangeConstraints constraints;
-
constraints.seamlessRequired = true;
constraints.desiredTimeNanos = systemTime();
for (VtsDisplay& display : mDisplays) {
- forEachTwoConfigs(display.get(), [&](int32_t config1, int32_t config2) {
- int32_t configGroup1;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config1,
- DisplayAttribute::CONFIG_GROUP, &configGroup1)
- .isOk());
- int32_t configGroup2;
- EXPECT_TRUE(mComposerClient
- ->getDisplayAttribute(display.get(), config2,
- DisplayAttribute::CONFIG_GROUP, &configGroup2)
- .isOk());
+ forEachTwoConfigs(display.getDisplayId(), [&](int32_t config1, int32_t config2) {
+ int32_t configGroup1 = display.getDisplayConfig(config1).configGroup;
+ int32_t configGroup2 = display.getDisplayConfig(config2).configGroup;
if (configGroup1 != configGroup2) {
- setActiveConfig(display, config1);
+ EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk());
sendRefreshFrame(display, nullptr);
+ const auto& [status, _] = mComposerClient->setActiveConfigWithConstraints(
+ &display, config2, constraints);
+ EXPECT_FALSE(status.isOk());
EXPECT_EQ(IComposerClient::EX_SEAMLESS_NOT_ALLOWED,
- setActiveConfigWithConstraints(display, config2, constraints, &timeline)
- .getServiceSpecificError());
+ status.getServiceSpecificError());
}
});
}
}
-TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_NoTimestamp) {
- ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(std::nullopt));
+TEST_P(GraphicsComposerAidlCommandTest, ExpectedPresentTime_NoTimestamp) {
+ ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(/*framesDelay*/ std::nullopt));
}
-TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_0) {
- ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(0));
+TEST_P(GraphicsComposerAidlCommandTest, ExpectedPresentTime_0) {
+ ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(/*framesDelay*/ 0));
}
-TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_5) {
- ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(5));
+TEST_P(GraphicsComposerAidlCommandTest, ExpectedPresentTime_5) {
+ ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(/*framesDelay*/ 5));
}
-TEST_P(GraphicsComposerAidlCommandTest, setIdleTimerEnabled_Unsupported) {
- const bool hasDisplayIdleTimerSupport = hasDisplayCapability(mPrimaryDisplay,
- DisplayCapability::DISPLAY_IDLE_TIMER);
+TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Unsupported) {
+ const bool hasDisplayIdleTimerSupport =
+ hasDisplayCapability(getPrimaryDisplayId(), DisplayCapability::DISPLAY_IDLE_TIMER);
if (!hasDisplayIdleTimerSupport) {
- const auto error = mComposerClient->setIdleTimerEnabled(mPrimaryDisplay, 0);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
+ const auto& status =
+ mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ 0);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, status.getServiceSpecificError());
}
}
-TEST_P(GraphicsComposerAidlCommandTest, setIdleTimerEnabled_BadParameter) {
- const bool hasDisplayIdleTimerSupport = hasDisplayCapability(mPrimaryDisplay,
- DisplayCapability::DISPLAY_IDLE_TIMER);
+TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_BadParameter) {
+ const bool hasDisplayIdleTimerSupport =
+ hasDisplayCapability(getPrimaryDisplayId(), DisplayCapability::DISPLAY_IDLE_TIMER);
if (!hasDisplayIdleTimerSupport) {
GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported";
return;
}
- const auto error = mComposerClient->setIdleTimerEnabled(mPrimaryDisplay, -1);
- EXPECT_FALSE(error.isOk());
- EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, error.getServiceSpecificError());
+ const auto& status =
+ mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ -1);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
}
-TEST_P(GraphicsComposerAidlCommandTest, setIdleTimerEnabled_Disable) {
- const bool hasDisplayIdleTimerSupport = hasDisplayCapability(mPrimaryDisplay,
- DisplayCapability::DISPLAY_IDLE_TIMER);
+TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Disable) {
+ const bool hasDisplayIdleTimerSupport =
+ hasDisplayCapability(getPrimaryDisplayId(), DisplayCapability::DISPLAY_IDLE_TIMER);
if (!hasDisplayIdleTimerSupport) {
GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported";
return;
}
- EXPECT_TRUE(mComposerClient->setIdleTimerEnabled(mPrimaryDisplay, 0).isOk());
+ EXPECT_TRUE(mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ 0).isOk());
std::this_thread::sleep_for(1s);
- EXPECT_EQ(0, mComposerCallback->getVsyncIdleCount());
+ EXPECT_EQ(0, mComposerClient->getVsyncIdleCount());
}
-TEST_P(GraphicsComposerAidlCommandTest, setIdleTimerEnabled_Timeout_2) {
- const bool hasDisplayIdleTimerSupport = hasDisplayCapability(mPrimaryDisplay,
- DisplayCapability::DISPLAY_IDLE_TIMER);
+TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Timeout_2) {
+ const bool hasDisplayIdleTimerSupport =
+ hasDisplayCapability(getPrimaryDisplayId(), DisplayCapability::DISPLAY_IDLE_TIMER);
if (!hasDisplayIdleTimerSupport) {
GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported";
return;
}
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON).isOk());
- EXPECT_TRUE(mComposerClient->setIdleTimerEnabled(mPrimaryDisplay, 0).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk());
+ EXPECT_TRUE(mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ 0).isOk());
const auto buffer = allocate();
ASSERT_NE(nullptr, buffer->handle);
const auto layer = createOnScreenLayer();
- mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, buffer->handle, -1);
- int32_t vsyncIdleCount = mComposerCallback->getVsyncIdleCount();
+ mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer->handle,
+ /*acquireFence*/ -1);
+ int32_t vsyncIdleCount = mComposerClient->getVsyncIdleCount();
auto earlyVsyncIdleTime = systemTime() + std::chrono::nanoseconds(2s).count();
- EXPECT_TRUE(mComposerClient->setIdleTimerEnabled(mPrimaryDisplay, 2000).isOk());
+ EXPECT_TRUE(
+ mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ 2000).isOk());
const sp<::android::Fence> presentFence =
- presentAndGetFence(ComposerClientWriter::kNoTimestamp);
+ presentAndGetFence(ComposerClientWriter::kNoTimestamp);
presentFence->waitForever(LOG_TAG);
std::this_thread::sleep_for(3s);
- if (vsyncIdleCount < mComposerCallback->getVsyncIdleCount()) {
- EXPECT_GE(mComposerCallback->getVsyncIdleTime(), earlyVsyncIdleTime);
+ if (vsyncIdleCount < mComposerClient->getVsyncIdleCount()) {
+ EXPECT_GE(mComposerClient->getVsyncIdleTime(), earlyVsyncIdleTime);
}
- EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF).isOk());
+ EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest);
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/Android.bp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/Android.bp
deleted file mode 100644
index df038db..0000000
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/Android.bp
+++ /dev/null
@@ -1,78 +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 {
- // 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.graphics.composer@3-vts",
- defaults: ["hidl_defaults"],
- srcs: [
- "GraphicsComposerCallback.cpp",
- "ReadbackVts.cpp",
- "RenderEngineVts.cpp",
- ],
- header_libs: [
- "android.hardware.graphics.composer3-command-buffer",
- ],
- static_libs: [
- "android.hardware.graphics.composer3-V1-ndk",
- "android.hardware.graphics.common-V3-ndk",
- "android.hardware.common-V2-ndk",
- "android.hardware.common.fmq-V1-ndk",
- "libarect",
- "libgtest",
- "libbase",
- "libfmq",
- "libsync",
- "libmath",
- "libaidlcommonsupport",
- "libnativewindow",
- "librenderengine",
- "libshaders",
- "libtonemap",
- "android.hardware.graphics.mapper@2.0-vts",
- "android.hardware.graphics.mapper@2.1-vts",
- "android.hardware.graphics.mapper@3.0-vts",
- "android.hardware.graphics.mapper@4.0-vts",
- ],
- shared_libs: [
- "libbinder_ndk",
- "libhidlbase",
- "libui",
- "android.hardware.graphics.composer3-V1-ndk",
- ],
- export_static_lib_headers: [
- "android.hardware.graphics.mapper@2.1-vts",
- "librenderengine",
- ],
- cflags: [
- "-O0",
- "-g",
- "-DLOG_TAG=\"ComposerVts\"",
- "-Wconversion",
- ],
- export_header_lib_headers: [
- "android.hardware.graphics.composer3-command-buffer",
- ],
- export_include_dirs: ["include"],
-}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
index 587c523..553eec3 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
@@ -14,19 +14,12 @@
* limitations under the License.
*/
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-
#include "include/ReadbackVts.h"
#include <aidl/android/hardware/graphics/common/BufferUsage.h>
#include "include/RenderEngineVts.h"
#include "renderengine/ExternalTexture.h"
#include "renderengine/impl/ExternalTexture.h"
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic pop // ignored "-Wconversion
-
namespace aidl::android::hardware::graphics::composer3::vts {
const std::vector<ColorMode> ReadbackHelper::colorModes = {ColorMode::SRGB, ColorMode::DISPLAY_P3};
@@ -41,7 +34,7 @@
writer.setLayerTransform(mDisplay, mLayer, mTransform);
writer.setLayerPlaneAlpha(mDisplay, mLayer, mAlpha);
writer.setLayerBlendMode(mDisplay, mLayer, mBlendMode);
- writer.setLayerWhitePointNits(mDisplay, mLayer, mWhitePointNits);
+ writer.setLayerBrightness(mDisplay, mLayer, mBrightness);
}
std::string ReadbackHelper::getColorModeString(ColorMode mode) {
@@ -195,13 +188,12 @@
}
}
-ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr<IComposerClient>& client,
+ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr<VtsComposerClient>& client,
int32_t width, int32_t height, common::PixelFormat pixelFormat,
- common::Dataspace dataspace) {
+ common::Dataspace dataspace)
+ : mComposerClient(client) {
mDisplay = display;
- mComposerClient = client;
-
mPixelFormat = pixelFormat;
mDataspace = dataspace;
@@ -217,33 +209,32 @@
mAccessRegion.bottom = static_cast<int32_t>(height);
}
-::android::sp<::android::GraphicBuffer> ReadbackBuffer::allocate() {
+::android::sp<::android::GraphicBuffer> ReadbackBuffer::allocateBuffer() {
return ::android::sp<::android::GraphicBuffer>::make(
mWidth, mHeight, static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, mUsage,
- "ReadbackVts");
+ "ReadbackBuffer");
}
void ReadbackBuffer::setReadbackBuffer() {
- mGraphicBuffer = allocate();
+ mGraphicBuffer = allocateBuffer();
ASSERT_NE(nullptr, mGraphicBuffer);
ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck());
- aidl::android::hardware::common::NativeHandle bufferHandle =
- ::android::dupToAidl(mGraphicBuffer->handle);
+ const auto& bufferHandle = mGraphicBuffer->handle;
::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1);
EXPECT_TRUE(mComposerClient->setReadbackBuffer(mDisplay, bufferHandle, fence).isOk());
}
-void ReadbackBuffer::checkReadbackBuffer(std::vector<Color> expectedColors) {
+void ReadbackBuffer::checkReadbackBuffer(const std::vector<Color>& expectedColors) {
ASSERT_NE(nullptr, mGraphicBuffer);
// lock buffer for reading
- ndk::ScopedFileDescriptor fenceHandle;
- EXPECT_TRUE(mComposerClient->getReadbackBufferFence(mDisplay, &fenceHandle).isOk());
+ 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(fenceHandle.get()),
+ 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);
@@ -270,13 +261,11 @@
return layerSettings;
}
-TestBufferLayer::TestBufferLayer(const std::shared_ptr<IComposerClient>& client,
- const ::android::sp<::android::GraphicBuffer>& graphicBuffer,
+TestBufferLayer::TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client,
TestRenderEngine& renderEngine, int64_t display, uint32_t width,
uint32_t height, common::PixelFormat format,
Composition composition)
: TestLayer{client, display}, mRenderEngine(renderEngine) {
- mGraphicBuffer = graphicBuffer;
mComposition = composition;
mWidth = width;
mHeight = height;
@@ -299,8 +288,9 @@
TestLayer::write(writer);
writer.setLayerCompositionType(mDisplay, mLayer, mComposition);
writer.setLayerVisibleRegion(mDisplay, mLayer, std::vector<Rect>(1, mDisplayFrame));
- if (mGraphicBuffer->handle != nullptr)
- writer.setLayerBuffer(mDisplay, mLayer, 0, mGraphicBuffer->handle, mFillFence);
+ if (mGraphicBuffer) {
+ writer.setLayerBuffer(mDisplay, mLayer, /*slot*/ 0, mGraphicBuffer->handle, mFillFence);
+ }
}
LayerSettings TestBufferLayer::toRenderEngineLayerSettings() {
@@ -318,8 +308,8 @@
const float translateY = mSourceCrop.top / (static_cast<float>(mHeight));
layerSettings.source.buffer.textureTransform =
- ::android::mat4::translate(::android::vec4(translateX, translateY, 0, 1.0)) *
- ::android::mat4::scale(::android::vec4(scaleX, scaleY, 1.0, 1.0));
+ ::android::mat4::translate(::android::vec4(translateX, translateY, 0.0f, 1.0f)) *
+ ::android::mat4::scale(::android::vec4(scaleX, scaleY, 1.0f, 1.0f));
return layerSettings;
}
@@ -335,16 +325,26 @@
EXPECT_EQ(::android::OK, status);
ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(mWidth, mHeight, stride, bufData,
mPixelFormat, expectedColors));
- EXPECT_EQ(::android::OK, mGraphicBuffer->unlock());
+
+ const auto unlockStatus = mGraphicBuffer->unlockAsync(&mFillFence);
+ ASSERT_EQ(::android::OK, unlockStatus);
+ if (mFillFence >= 0) {
+ sync_wait(mFillFence, -1);
+ close(mFillFence);
+ }
}
void TestBufferLayer::setBuffer(std::vector<Color> colors) {
- mGraphicBuffer->reallocate(mWidth, mHeight, static_cast<::android::PixelFormat>(mPixelFormat),
- mLayerCount, mUsage);
+ mGraphicBuffer = allocateBuffer();
ASSERT_NE(nullptr, mGraphicBuffer);
- ASSERT_NE(nullptr, mGraphicBuffer->handle);
- ASSERT_NO_FATAL_FAILURE(fillBuffer(colors));
ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck());
+ ASSERT_NO_FATAL_FAILURE(fillBuffer(colors));
+}
+
+::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/android/hardware/graphics/composer3/vts/functional/composer-vts/VtsComposerClient.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/VtsComposerClient.cpp
new file mode 100644
index 0000000..8c882d0
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/VtsComposerClient.cpp
@@ -0,0 +1,502 @@
+/**
+ * Copyright (c) 2022, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/VtsComposerClient.h"
+#include <aidlcommonsupport/NativeHandle.h>
+#include <android-base/logging.h>
+#include <log/log_main.h>
+
+#undef LOG_TAG
+#define LOG_TAG "VtsComposerClient"
+
+using namespace std::chrono_literals;
+
+namespace aidl::android::hardware::graphics::composer3::vts {
+
+VtsComposerClient::VtsComposerClient(const std::string& name) {
+ SpAIBinder binder(AServiceManager_waitForService(name.c_str()));
+ ALOGE_IF(binder == nullptr, "Could not initialize the service binder");
+ if (binder != nullptr) {
+ mComposer = IComposer::fromBinder(binder);
+ ALOGE_IF(mComposer == nullptr, "Failed to acquire the composer from the binder");
+ }
+}
+
+ScopedAStatus VtsComposerClient::createClient() {
+ if (mComposer == nullptr) {
+ ALOGE("IComposer not initialized");
+ return ScopedAStatus::fromServiceSpecificError(IComposerClient::INVALID_CONFIGURATION);
+ }
+ auto status = mComposer->createClient(&mComposerClient);
+ if (!status.isOk() || mComposerClient == nullptr) {
+ ALOGE("Failed to create client for IComposerClient with %s",
+ status.getDescription().c_str());
+ return status;
+ }
+ mComposerCallback = SharedRefBase::make<GraphicsComposerCallback>();
+ if (mComposerCallback == nullptr) {
+ ALOGE("Unable to create ComposerCallback");
+ return ScopedAStatus::fromServiceSpecificError(IComposerClient::INVALID_CONFIGURATION);
+ }
+ return mComposerClient->registerCallback(mComposerCallback);
+}
+
+bool VtsComposerClient::tearDown() {
+ return verifyComposerCallbackParams() && destroyAllLayers();
+}
+
+std::pair<ScopedAStatus, VirtualDisplay> VtsComposerClient::createVirtualDisplay(
+ int32_t width, int32_t height, PixelFormat pixelFormat, int32_t bufferSlotCount) {
+ VirtualDisplay outVirtualDisplay;
+ auto status = mComposerClient->createVirtualDisplay(width, height, pixelFormat, bufferSlotCount,
+ &outVirtualDisplay);
+ if (!status.isOk()) {
+ return {std::move(status), outVirtualDisplay};
+ }
+ return {addDisplayToDisplayResources(outVirtualDisplay.display, /*isVirtual*/ true),
+ outVirtualDisplay};
+}
+
+ScopedAStatus VtsComposerClient::destroyVirtualDisplay(int64_t display) {
+ auto status = mComposerClient->destroyVirtualDisplay(display);
+ if (!status.isOk()) {
+ return status;
+ }
+ mDisplayResources.erase(display);
+ return status;
+}
+
+std::pair<ScopedAStatus, int64_t> VtsComposerClient::createLayer(int64_t display,
+ int32_t bufferSlotCount) {
+ int64_t outLayer;
+ auto status = mComposerClient->createLayer(display, bufferSlotCount, &outLayer);
+
+ if (!status.isOk()) {
+ return {std::move(status), outLayer};
+ }
+ return {addLayerToDisplayResources(display, outLayer), outLayer};
+}
+
+ScopedAStatus VtsComposerClient::destroyLayer(int64_t display, int64_t layer) {
+ auto status = mComposerClient->destroyLayer(display, layer);
+
+ if (!status.isOk()) {
+ return status;
+ }
+ removeLayerFromDisplayResources(display, layer);
+ return status;
+}
+
+std::pair<ScopedAStatus, int32_t> VtsComposerClient::getActiveConfig(int64_t display) {
+ int32_t outConfig;
+ return {mComposerClient->getActiveConfig(display, &outConfig), outConfig};
+}
+
+ScopedAStatus VtsComposerClient::setActiveConfig(VtsDisplay* vtsDisplay, int32_t config) {
+ auto status = mComposerClient->setActiveConfig(vtsDisplay->getDisplayId(), config);
+ if (!status.isOk()) {
+ return status;
+ }
+ return updateDisplayProperties(vtsDisplay, config);
+}
+
+std::pair<ScopedAStatus, int32_t> VtsComposerClient::getDisplayAttribute(
+ int64_t display, int32_t config, DisplayAttribute displayAttribute) {
+ int32_t outDisplayAttribute;
+ return {mComposerClient->getDisplayAttribute(display, config, displayAttribute,
+ &outDisplayAttribute),
+ outDisplayAttribute};
+}
+
+ScopedAStatus VtsComposerClient::setPowerMode(int64_t display, PowerMode powerMode) {
+ return mComposerClient->setPowerMode(display, powerMode);
+}
+
+ScopedAStatus VtsComposerClient::setVsync(int64_t display, bool enable) {
+ return mComposerClient->setVsyncEnabled(display, enable);
+}
+
+void VtsComposerClient::setVsyncAllowed(bool isAllowed) {
+ mComposerCallback->setVsyncAllowed(isAllowed);
+}
+
+std::pair<ScopedAStatus, std::vector<float>> VtsComposerClient::getDataspaceSaturationMatrix(
+ Dataspace dataspace) {
+ std::vector<float> outMatrix;
+ return {mComposerClient->getDataspaceSaturationMatrix(dataspace, &outMatrix), outMatrix};
+}
+
+std::pair<ScopedAStatus, std::vector<CommandResultPayload>> VtsComposerClient::executeCommands(
+ const std::vector<DisplayCommand>& commands) {
+ std::vector<CommandResultPayload> outResultPayload;
+ return {mComposerClient->executeCommands(commands, &outResultPayload),
+ std::move(outResultPayload)};
+}
+
+std::optional<VsyncPeriodChangeTimeline> VtsComposerClient::takeLastVsyncPeriodChangeTimeline() {
+ return mComposerCallback->takeLastVsyncPeriodChangeTimeline();
+}
+
+ScopedAStatus VtsComposerClient::setContentType(int64_t display, ContentType contentType) {
+ return mComposerClient->setContentType(display, contentType);
+}
+
+std::pair<ScopedAStatus, VsyncPeriodChangeTimeline>
+VtsComposerClient::setActiveConfigWithConstraints(VtsDisplay* vtsDisplay, int32_t config,
+ const VsyncPeriodChangeConstraints& constraints) {
+ VsyncPeriodChangeTimeline outTimeline;
+ auto status = mComposerClient->setActiveConfigWithConstraints(
+ vtsDisplay->getDisplayId(), config, constraints, &outTimeline);
+ if (!status.isOk()) {
+ return {std::move(status), outTimeline};
+ }
+ return {updateDisplayProperties(vtsDisplay, config), outTimeline};
+}
+
+std::pair<ScopedAStatus, std::vector<DisplayCapability>> VtsComposerClient::getDisplayCapabilities(
+ int64_t display) {
+ std::vector<DisplayCapability> outCapabilities;
+ return {mComposerClient->getDisplayCapabilities(display, &outCapabilities), outCapabilities};
+}
+
+ScopedAStatus VtsComposerClient::dumpDebugInfo() {
+ std::string debugInfo;
+ return mComposer->dumpDebugInfo(&debugInfo);
+}
+
+std::pair<ScopedAStatus, DisplayIdentification> VtsComposerClient::getDisplayIdentificationData(
+ int64_t display) {
+ DisplayIdentification outDisplayIdentification;
+ return {mComposerClient->getDisplayIdentificationData(display, &outDisplayIdentification),
+ outDisplayIdentification};
+}
+
+std::pair<ScopedAStatus, HdrCapabilities> VtsComposerClient::getHdrCapabilities(int64_t display) {
+ HdrCapabilities outHdrCapabilities;
+ return {mComposerClient->getHdrCapabilities(display, &outHdrCapabilities), outHdrCapabilities};
+}
+
+std::pair<ScopedAStatus, std::vector<PerFrameMetadataKey>>
+VtsComposerClient::getPerFrameMetadataKeys(int64_t display) {
+ std::vector<PerFrameMetadataKey> outPerFrameMetadataKeys;
+ return {mComposerClient->getPerFrameMetadataKeys(display, &outPerFrameMetadataKeys),
+ outPerFrameMetadataKeys};
+}
+
+std::pair<ScopedAStatus, ReadbackBufferAttributes> VtsComposerClient::getReadbackBufferAttributes(
+ int64_t display) {
+ ReadbackBufferAttributes outReadbackBufferAttributes;
+ return {mComposerClient->getReadbackBufferAttributes(display, &outReadbackBufferAttributes),
+ outReadbackBufferAttributes};
+}
+
+ScopedAStatus VtsComposerClient::setReadbackBuffer(int64_t display, const native_handle_t* buffer,
+ const ScopedFileDescriptor& releaseFence) {
+ return mComposerClient->setReadbackBuffer(display, ::android::dupToAidl(buffer), releaseFence);
+}
+
+std::pair<ScopedAStatus, ScopedFileDescriptor> VtsComposerClient::getReadbackBufferFence(
+ int64_t display) {
+ ScopedFileDescriptor outReleaseFence;
+ return {mComposerClient->getReadbackBufferFence(display, &outReleaseFence),
+ std::move(outReleaseFence)};
+}
+
+std::pair<ScopedAStatus, std::vector<ColorMode>> VtsComposerClient::getColorModes(int64_t display) {
+ std::vector<ColorMode> outColorModes;
+ return {mComposerClient->getColorModes(display, &outColorModes), outColorModes};
+}
+
+std::pair<ScopedAStatus, std::vector<RenderIntent>> VtsComposerClient::getRenderIntents(
+ int64_t display, ColorMode colorMode) {
+ std::vector<RenderIntent> outRenderIntents;
+ return {mComposerClient->getRenderIntents(display, colorMode, &outRenderIntents),
+ outRenderIntents};
+}
+
+ScopedAStatus VtsComposerClient::setColorMode(int64_t display, ColorMode colorMode,
+ RenderIntent renderIntent) {
+ return mComposerClient->setColorMode(display, colorMode, renderIntent);
+}
+
+std::pair<ScopedAStatus, DisplayContentSamplingAttributes>
+VtsComposerClient::getDisplayedContentSamplingAttributes(int64_t display) {
+ DisplayContentSamplingAttributes outAttributes;
+ return {mComposerClient->getDisplayedContentSamplingAttributes(display, &outAttributes),
+ outAttributes};
+}
+
+ScopedAStatus VtsComposerClient::setDisplayedContentSamplingEnabled(
+ int64_t display, bool isEnabled, FormatColorComponent formatColorComponent,
+ int64_t maxFrames) {
+ return mComposerClient->setDisplayedContentSamplingEnabled(display, isEnabled,
+ formatColorComponent, maxFrames);
+}
+
+std::pair<ScopedAStatus, DisplayContentSample> VtsComposerClient::getDisplayedContentSample(
+ int64_t display, int64_t maxFrames, int64_t timestamp) {
+ DisplayContentSample outDisplayContentSample;
+ return {mComposerClient->getDisplayedContentSample(display, maxFrames, timestamp,
+ &outDisplayContentSample),
+ outDisplayContentSample};
+}
+
+std::pair<ScopedAStatus, DisplayConnectionType> VtsComposerClient::getDisplayConnectionType(
+ int64_t display) {
+ DisplayConnectionType outDisplayConnectionType;
+ return {mComposerClient->getDisplayConnectionType(display, &outDisplayConnectionType),
+ outDisplayConnectionType};
+}
+
+std::pair<ScopedAStatus, std::vector<int32_t>> VtsComposerClient::getDisplayConfigs(
+ int64_t display) {
+ std::vector<int32_t> outConfigs;
+ return {mComposerClient->getDisplayConfigs(display, &outConfigs), outConfigs};
+}
+
+std::pair<ScopedAStatus, int32_t> VtsComposerClient::getDisplayVsyncPeriod(int64_t display) {
+ int32_t outVsyncPeriodNanos;
+ return {mComposerClient->getDisplayVsyncPeriod(display, &outVsyncPeriodNanos),
+ outVsyncPeriodNanos};
+}
+
+ScopedAStatus VtsComposerClient::setAutoLowLatencyMode(int64_t display, bool isEnabled) {
+ return mComposerClient->setAutoLowLatencyMode(display, isEnabled);
+}
+
+std::pair<ScopedAStatus, std::vector<ContentType>> VtsComposerClient::getSupportedContentTypes(
+ int64_t display) {
+ std::vector<ContentType> outContentTypes;
+ return {mComposerClient->getSupportedContentTypes(display, &outContentTypes), outContentTypes};
+}
+
+std::pair<ScopedAStatus, int32_t> VtsComposerClient::getMaxVirtualDisplayCount() {
+ int32_t outMaxVirtualDisplayCount;
+ return {mComposerClient->getMaxVirtualDisplayCount(&outMaxVirtualDisplayCount),
+ outMaxVirtualDisplayCount};
+}
+
+std::pair<ScopedAStatus, std::string> VtsComposerClient::getDisplayName(int64_t display) {
+ std::string outDisplayName;
+ return {mComposerClient->getDisplayName(display, &outDisplayName), outDisplayName};
+}
+
+ScopedAStatus VtsComposerClient::setClientTargetSlotCount(int64_t display,
+ int32_t bufferSlotCount) {
+ return mComposerClient->setClientTargetSlotCount(display, bufferSlotCount);
+}
+
+std::pair<ScopedAStatus, std::vector<Capability>> VtsComposerClient::getCapabilities() {
+ std::vector<Capability> outCapabilities;
+ return {mComposer->getCapabilities(&outCapabilities), outCapabilities};
+}
+
+ScopedAStatus VtsComposerClient::setBootDisplayConfig(int64_t display, int32_t config) {
+ return mComposerClient->setBootDisplayConfig(display, config);
+}
+
+ScopedAStatus VtsComposerClient::clearBootDisplayConfig(int64_t display) {
+ return mComposerClient->clearBootDisplayConfig(display);
+}
+
+std::pair<ScopedAStatus, int32_t> VtsComposerClient::getPreferredBootDisplayConfig(
+ int64_t display) {
+ int32_t outConfig;
+ return {mComposerClient->getPreferredBootDisplayConfig(display, &outConfig), outConfig};
+}
+
+std::pair<ScopedAStatus, common::Transform> VtsComposerClient::getDisplayPhysicalOrientation(
+ int64_t display) {
+ common::Transform outDisplayOrientation;
+ return {mComposerClient->getDisplayPhysicalOrientation(display, &outDisplayOrientation),
+ outDisplayOrientation};
+}
+
+ScopedAStatus VtsComposerClient::setIdleTimerEnabled(int64_t display, int32_t timeoutMs) {
+ return mComposerClient->setIdleTimerEnabled(display, timeoutMs);
+}
+
+int32_t VtsComposerClient::getVsyncIdleCount() {
+ return mComposerCallback->getVsyncIdleCount();
+}
+
+int64_t VtsComposerClient::getVsyncIdleTime() {
+ return mComposerCallback->getVsyncIdleTime();
+}
+
+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
+ // std::numeric_limit<uint64_t>::max() displays registered while running tests
+ int64_t id = std::numeric_limits<int64_t>::max();
+ std::vector<int64_t> displays = mComposerCallback->getDisplays();
+ while (id > 0) {
+ if (std::none_of(displays.begin(), displays.end(),
+ [id](const auto& display) { return id == display; })) {
+ return id;
+ }
+ id--;
+ }
+
+ // Although 0 could be an invalid display, a return value of 0
+ // from getInvalidDisplayId means all other ids are in use, a condition which
+ // we are assuming a device will never have
+ EXPECT_NE(0, id);
+ return id;
+}
+
+std::pair<ScopedAStatus, std::vector<VtsDisplay>> VtsComposerClient::getDisplays() {
+ while (true) {
+ // Sleep for a small period of time to allow all built-in displays
+ // to post hotplug events
+ std::this_thread::sleep_for(5ms);
+ std::vector<int64_t> displays = mComposerCallback->getDisplays();
+ if (displays.empty()) {
+ continue;
+ }
+
+ std::vector<VtsDisplay> vtsDisplays;
+ vtsDisplays.reserve(displays.size());
+ for (int64_t display : displays) {
+ auto vtsDisplay = VtsDisplay{display};
+ auto configs = getDisplayConfigs(display);
+ if (!configs.first.isOk()) {
+ ALOGE("Unable to get the displays for test, failed to get the configs "
+ "for display %" PRId64,
+ display);
+ return {std::move(configs.first), vtsDisplays};
+ }
+ for (int config : configs.second) {
+ auto status = updateDisplayProperties(&vtsDisplay, config);
+ if (!status.isOk()) {
+ ALOGE("Unable to get the displays for test, failed to update the properties "
+ "for display %" PRId64,
+ display);
+ return {std::move(status), vtsDisplays};
+ }
+ }
+ vtsDisplays.emplace_back(vtsDisplay);
+ addDisplayToDisplayResources(display, /*isVirtual*/ false);
+ }
+
+ return {ScopedAStatus::ok(), vtsDisplays};
+ }
+}
+
+ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config) {
+ const auto width =
+ getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH);
+ const auto height =
+ getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::HEIGHT);
+ const auto vsyncPeriod =
+ getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::VSYNC_PERIOD);
+ const auto configGroup =
+ getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::CONFIG_GROUP);
+ if (width.first.isOk() && height.first.isOk() && vsyncPeriod.first.isOk() &&
+ configGroup.first.isOk()) {
+ vtsDisplay->setDimensions(width.second, height.second);
+ vtsDisplay->addDisplayConfig(config, {vsyncPeriod.second, configGroup.second});
+ return ScopedAStatus::ok();
+ }
+
+ LOG(ERROR) << "Failed to update display property for width: " << width.first.isOk()
+ << ", height: " << height.first.isOk() << ", vsync: " << vsyncPeriod.first.isOk()
+ << ", config: " << configGroup.first.isOk();
+ return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_CONFIG);
+}
+
+ScopedAStatus VtsComposerClient::addDisplayToDisplayResources(int64_t display, bool isVirtual) {
+ if (mDisplayResources.insert({display, DisplayResource(isVirtual)}).second) {
+ return ScopedAStatus::ok();
+ }
+
+ ALOGE("Duplicate display id %" PRId64, display);
+ return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_DISPLAY);
+}
+
+ScopedAStatus VtsComposerClient::addLayerToDisplayResources(int64_t display, int64_t layer) {
+ auto resource = mDisplayResources.find(display);
+ if (resource == mDisplayResources.end()) {
+ resource = mDisplayResources.insert({display, DisplayResource(false)}).first;
+ }
+
+ if (!resource->second.layers.insert(layer).second) {
+ ALOGE("Duplicate layer id %" PRId64, layer);
+ return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_LAYER);
+ }
+ return ScopedAStatus::ok();
+}
+
+void VtsComposerClient::removeLayerFromDisplayResources(int64_t display, int64_t layer) {
+ auto resource = mDisplayResources.find(display);
+ if (resource != mDisplayResources.end()) {
+ resource->second.layers.erase(layer);
+ }
+}
+
+bool VtsComposerClient::verifyComposerCallbackParams() {
+ bool isValid = true;
+ if (mComposerCallback != nullptr) {
+ if (mComposerCallback->getInvalidHotplugCount() != 0) {
+ ALOGE("Invalid hotplug count");
+ isValid = false;
+ }
+ if (mComposerCallback->getInvalidRefreshCount() != 0) {
+ ALOGE("Invalid refresh count");
+ isValid = false;
+ }
+ if (mComposerCallback->getInvalidVsyncCount() != 0) {
+ ALOGE("Invalid vsync count");
+ isValid = false;
+ }
+ if (mComposerCallback->getInvalidVsyncPeriodChangeCount() != 0) {
+ ALOGE("Invalid vsync period change count");
+ isValid = false;
+ }
+ if (mComposerCallback->getInvalidSeamlessPossibleCount() != 0) {
+ ALOGE("Invalid seamless possible count");
+ isValid = false;
+ }
+ }
+ return isValid;
+}
+
+bool VtsComposerClient::destroyAllLayers() {
+ for (const auto& it : mDisplayResources) {
+ const auto& [display, resource] = it;
+
+ for (auto layer : resource.layers) {
+ const auto status = destroyLayer(display, layer);
+ if (!status.isOk()) {
+ ALOGE("Unable to destroy all the layers, failed at layer %" PRId64 " with error %s",
+ layer, status.getDescription().c_str());
+ return false;
+ }
+ }
+
+ if (resource.isVirtual) {
+ const auto status = destroyVirtualDisplay(display);
+ if (!status.isOk()) {
+ ALOGE("Unable to destroy the display %" PRId64 " failed with error %s", display,
+ status.getDescription().c_str());
+ return false;
+ }
+ }
+ }
+ mDisplayResources.clear();
+ return true;
+}
+} // namespace aidl::android::hardware::graphics::composer3::vts
\ No newline at end of file
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/GraphicsComposerCallback.h b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/GraphicsComposerCallback.h
index f25f36d..ced1020 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/GraphicsComposerCallback.h
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/GraphicsComposerCallback.h
@@ -15,18 +15,11 @@
*/
#pragma once
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-
#include <aidl/android/hardware/graphics/composer3/BnComposerCallback.h>
#include <android-base/thread_annotations.h>
#include <mutex>
#include <unordered_set>
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic pop // ignored "-Wconversion
-
namespace aidl::android::hardware::graphics::composer3::vts {
class GraphicsComposerCallback : public BnComposerCallback {
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/ReadbackVts.h b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/ReadbackVts.h
index a3ce795..ee9f0d5 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/ReadbackVts.h
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/ReadbackVts.h
@@ -16,11 +16,6 @@
#pragma once
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-
-#include <GraphicsComposerCallback.h>
#include <aidl/android/hardware/graphics/composer3/IComposerClient.h>
#include <android-base/unique_fd.h>
#include <android/hardware/graphics/composer3/ComposerClientReader.h>
@@ -28,11 +23,9 @@
#include <mapper-vts/2.1/MapperVts.h>
#include <renderengine/RenderEngine.h>
#include <ui/GraphicBuffer.h>
-
#include <memory>
-
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic pop // ignored "-Wconversion
+#include "GraphicsComposerCallback.h"
+#include "VtsComposerClient.h"
namespace aidl::android::hardware::graphics::composer3::vts {
@@ -56,9 +49,11 @@
class TestLayer {
public:
- TestLayer(const std::shared_ptr<IComposerClient>& client, int64_t display)
- : mDisplay(display), mComposerClient(client) {
- client->createLayer(display, kBufferSlotCount, &mLayer);
+ TestLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display)
+ : mDisplay(display) {
+ const auto& [status, layer] = client->createLayer(display, kBufferSlotCount);
+ EXPECT_TRUE(status.isOk());
+ mLayer = layer;
}
// ComposerClient will take care of destroying layers, no need to explicitly
@@ -72,6 +67,7 @@
void setSourceCrop(FRect crop) { mSourceCrop = crop; }
void setZOrder(uint32_t z) { mZOrder = z; }
void setWhitePointNits(float whitePointNits) { mWhitePointNits = whitePointNits; }
+ void setBrightness(float brightness) { mBrightness = brightness; }
void setSurfaceDamage(std::vector<Rect> surfaceDamage) {
mSurfaceDamage = std::move(surfaceDamage);
@@ -89,12 +85,13 @@
int64_t getLayer() const { return mLayer; }
- float getWhitePointNits() const { return mWhitePointNits; }
+ float getBrightness() const { return mBrightness; }
protected:
int64_t mDisplay;
int64_t mLayer;
Rect mDisplayFrame = {0, 0, 0, 0};
+ float mBrightness = 1.f;
float mWhitePointNits = -1.f;
std::vector<Rect> mSurfaceDamage;
Transform mTransform = static_cast<Transform>(0);
@@ -103,14 +100,11 @@
float mAlpha = 1.0;
BlendMode mBlendMode = BlendMode::NONE;
uint32_t mZOrder = 0;
-
- private:
- std::shared_ptr<IComposerClient> const mComposerClient;
};
class TestColorLayer : public TestLayer {
public:
- TestColorLayer(const std::shared_ptr<IComposerClient>& client, int64_t display)
+ TestColorLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display)
: TestLayer{client, display} {}
void write(ComposerClientWriter& writer) override;
@@ -125,8 +119,7 @@
class TestBufferLayer : public TestLayer {
public:
- TestBufferLayer(const std::shared_ptr<IComposerClient>& client,
- const ::android::sp<::android::GraphicBuffer>& graphicBuffer,
+ TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client,
TestRenderEngine& renderEngine, int64_t display, uint32_t width,
uint32_t height, common::PixelFormat format,
Composition composition = Composition::DEVICE);
@@ -162,6 +155,9 @@
PixelFormat mPixelFormat;
uint32_t mUsage;
::android::Rect mAccessRegion;
+
+ private:
+ ::android::sp<::android::GraphicBuffer> allocateBuffer();
};
class ReadbackHelper {
@@ -195,14 +191,12 @@
class ReadbackBuffer {
public:
- ReadbackBuffer(int64_t display, const std::shared_ptr<IComposerClient>& client, int32_t width,
+ ReadbackBuffer(int64_t display, const std::shared_ptr<VtsComposerClient>& client, int32_t width,
int32_t height, common::PixelFormat pixelFormat, common::Dataspace dataspace);
void setReadbackBuffer();
- void checkReadbackBuffer(std::vector<Color> expectedColors);
-
- ::android::sp<::android::GraphicBuffer> allocate();
+ void checkReadbackBuffer(const std::vector<Color>& expectedColors);
protected:
uint32_t mWidth;
@@ -213,9 +207,12 @@
Dataspace mDataspace;
int64_t mDisplay;
::android::sp<::android::GraphicBuffer> mGraphicBuffer;
- std::shared_ptr<IComposerClient> mComposerClient;
+ std::shared_ptr<VtsComposerClient> 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/android/hardware/graphics/composer3/vts/functional/composer-vts/include/RenderEngineVts.h b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/RenderEngineVts.h
index a776a27..43d3a42 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/RenderEngineVts.h
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/RenderEngineVts.h
@@ -15,11 +15,6 @@
*/
#pragma once
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-
-#include <ReadbackVts.h>
#include <mapper-vts/2.1/MapperVts.h>
#include <math/half.h>
#include <math/vec3.h>
@@ -30,9 +25,7 @@
#include <ui/PixelFormat.h>
#include <ui/Rect.h>
#include <ui/Region.h>
-
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic pop // ignored "-Wconversion
+#include "ReadbackVts.h"
namespace aidl::android::hardware::graphics::composer3::vts {
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/VtsComposerClient.h b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/VtsComposerClient.h
new file mode 100644
index 0000000..9af867c
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/VtsComposerClient.h
@@ -0,0 +1,240 @@
+/**
+ * Copyright (c) 2022, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 <aidl/android/hardware/graphics/common/BlendMode.h>
+#include <aidl/android/hardware/graphics/common/BufferUsage.h>
+#include <aidl/android/hardware/graphics/common/FRect.h>
+#include <aidl/android/hardware/graphics/common/Rect.h>
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+#include <aidl/android/hardware/graphics/composer3/IComposer.h>
+#include <android-base/properties.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <android/hardware/graphics/composer3/ComposerClientReader.h>
+#include <binder/ProcessState.h>
+#include <gtest/gtest.h>
+#include <ui/Fence.h>
+#include <ui/GraphicBuffer.h>
+#include <ui/PixelFormat.h>
+#include <algorithm>
+#include <numeric>
+#include <string>
+#include <thread>
+#include <unordered_map>
+#include "GraphicsComposerCallback.h"
+
+using aidl::android::hardware::graphics::common::Dataspace;
+using aidl::android::hardware::graphics::common::FRect;
+using aidl::android::hardware::graphics::common::PixelFormat;
+using aidl::android::hardware::graphics::common::Rect;
+using namespace ::ndk;
+
+namespace aidl::android::hardware::graphics::composer3::vts {
+
+class VtsDisplay;
+/**
+ * A wrapper to IComposerClient.
+ * This wrapper manages the IComposerClient instance and manages the resources for
+ * the tests with respect to the IComposerClient calls.
+ */
+class VtsComposerClient {
+ public:
+ VtsComposerClient(const std::string& name);
+
+ ScopedAStatus createClient();
+
+ bool tearDown();
+
+ std::pair<ScopedAStatus, VirtualDisplay> createVirtualDisplay(int32_t width, int32_t height,
+ PixelFormat pixelFormat,
+ int32_t bufferSlotCount);
+
+ ScopedAStatus destroyVirtualDisplay(int64_t display);
+
+ std::pair<ScopedAStatus, int64_t> createLayer(int64_t display, int32_t bufferSlotCount);
+
+ ScopedAStatus destroyLayer(int64_t display, int64_t layer);
+
+ std::pair<ScopedAStatus, int32_t> getActiveConfig(int64_t display);
+
+ ScopedAStatus setActiveConfig(VtsDisplay* vtsDisplay, int32_t config);
+
+ std::pair<ScopedAStatus, int32_t> getDisplayAttribute(int64_t display, int32_t config,
+ DisplayAttribute displayAttribute);
+
+ ScopedAStatus setPowerMode(int64_t display, PowerMode powerMode);
+
+ ScopedAStatus setVsync(int64_t display, bool enable);
+
+ void setVsyncAllowed(bool isAllowed);
+
+ std::pair<ScopedAStatus, std::vector<float>> getDataspaceSaturationMatrix(Dataspace dataspace);
+
+ std::pair<ScopedAStatus, std::vector<CommandResultPayload>> executeCommands(
+ const std::vector<DisplayCommand>& commands);
+
+ std::optional<VsyncPeriodChangeTimeline> takeLastVsyncPeriodChangeTimeline();
+
+ ScopedAStatus setContentType(int64_t display, ContentType contentType);
+
+ std::pair<ScopedAStatus, VsyncPeriodChangeTimeline> setActiveConfigWithConstraints(
+ VtsDisplay* vtsDisplay, int32_t config,
+ const VsyncPeriodChangeConstraints& constraints);
+
+ std::pair<ScopedAStatus, std::vector<DisplayCapability>> getDisplayCapabilities(
+ int64_t display);
+
+ ScopedAStatus dumpDebugInfo();
+
+ std::pair<ScopedAStatus, DisplayIdentification> getDisplayIdentificationData(int64_t display);
+
+ std::pair<ScopedAStatus, HdrCapabilities> getHdrCapabilities(int64_t display);
+
+ std::pair<ScopedAStatus, std::vector<PerFrameMetadataKey>> getPerFrameMetadataKeys(
+ int64_t display);
+
+ std::pair<ScopedAStatus, ReadbackBufferAttributes> getReadbackBufferAttributes(int64_t display);
+
+ ScopedAStatus setReadbackBuffer(int64_t display, const native_handle_t* buffer,
+ const ScopedFileDescriptor& releaseFence);
+
+ std::pair<ScopedAStatus, ScopedFileDescriptor> getReadbackBufferFence(int64_t display);
+
+ std::pair<ScopedAStatus, std::vector<ColorMode>> getColorModes(int64_t display);
+
+ std::pair<ScopedAStatus, std::vector<RenderIntent>> getRenderIntents(int64_t display,
+ ColorMode colorMode);
+
+ ScopedAStatus setColorMode(int64_t display, ColorMode colorMode, RenderIntent renderIntent);
+
+ std::pair<ScopedAStatus, DisplayContentSamplingAttributes>
+ getDisplayedContentSamplingAttributes(int64_t display);
+
+ ScopedAStatus setDisplayedContentSamplingEnabled(int64_t display, bool isEnabled,
+ FormatColorComponent formatColorComponent,
+ int64_t maxFrames);
+
+ std::pair<ScopedAStatus, DisplayContentSample> getDisplayedContentSample(int64_t display,
+ int64_t maxFrames,
+ int64_t timestamp);
+
+ std::pair<ScopedAStatus, DisplayConnectionType> getDisplayConnectionType(int64_t display);
+
+ std::pair<ScopedAStatus, std::vector<int32_t>> getDisplayConfigs(int64_t display);
+
+ std::pair<ScopedAStatus, int32_t> getDisplayVsyncPeriod(int64_t display);
+
+ ScopedAStatus setAutoLowLatencyMode(int64_t display, bool isEnabled);
+
+ std::pair<ScopedAStatus, std::vector<ContentType>> getSupportedContentTypes(int64_t display);
+
+ std::pair<ScopedAStatus, int32_t> getMaxVirtualDisplayCount();
+
+ std::pair<ScopedAStatus, std::string> getDisplayName(int64_t display);
+
+ ScopedAStatus setClientTargetSlotCount(int64_t display, int32_t bufferSlotCount);
+
+ std::pair<ScopedAStatus, std::vector<Capability>> getCapabilities();
+
+ ScopedAStatus setBootDisplayConfig(int64_t display, int32_t config);
+
+ ScopedAStatus clearBootDisplayConfig(int64_t display);
+
+ std::pair<ScopedAStatus, int32_t> getPreferredBootDisplayConfig(int64_t display);
+
+ std::pair<ScopedAStatus, common::Transform> getDisplayPhysicalOrientation(int64_t display);
+
+ ScopedAStatus setIdleTimerEnabled(int64_t display, int32_t timeoutMs);
+
+ int32_t getVsyncIdleCount();
+
+ int64_t getVsyncIdleTime();
+
+ int64_t getInvalidDisplayId();
+
+ std::pair<ScopedAStatus, std::vector<VtsDisplay>> getDisplays();
+
+ private:
+ ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config);
+
+ ScopedAStatus addDisplayToDisplayResources(int64_t display, bool isVirtual);
+
+ ScopedAStatus addLayerToDisplayResources(int64_t display, int64_t layer);
+
+ void removeLayerFromDisplayResources(int64_t display, int64_t layer);
+
+ bool destroyAllLayers();
+
+ bool verifyComposerCallbackParams();
+
+ // 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.
+ struct DisplayResource {
+ DisplayResource(bool isVirtual_) : isVirtual(isVirtual_) {}
+
+ bool isVirtual;
+ std::unordered_set<int64_t> layers;
+ };
+
+ std::shared_ptr<IComposer> mComposer;
+ std::shared_ptr<IComposerClient> mComposerClient;
+ std::shared_ptr<GraphicsComposerCallback> mComposerCallback;
+ std::unordered_map<int64_t, DisplayResource> mDisplayResources;
+};
+
+class VtsDisplay {
+ public:
+ VtsDisplay(int64_t displayId) : mDisplayId(displayId), mDisplayWidth(0), mDisplayHeight(0) {}
+
+ int64_t getDisplayId() const { return mDisplayId; }
+
+ FRect getCrop() const {
+ return {0, 0, static_cast<float>(mDisplayWidth), static_cast<float>(mDisplayHeight)};
+ }
+
+ Rect getFrameRect() const { return {0, 0, mDisplayWidth, mDisplayHeight}; }
+
+ void setDimensions(int32_t displayWidth, int32_t displayHeight) {
+ mDisplayWidth = displayWidth;
+ mDisplayHeight = displayHeight;
+ }
+
+ int32_t getDisplayWidth() const { return mDisplayWidth; }
+
+ int32_t getDisplayHeight() const { return mDisplayHeight; }
+
+ struct DisplayConfig {
+ DisplayConfig(int32_t vsyncPeriod_, int32_t configGroup_)
+ : vsyncPeriod(vsyncPeriod_), configGroup(configGroup_) {}
+ int32_t vsyncPeriod;
+ int32_t configGroup;
+ };
+
+ void addDisplayConfig(int32_t config, DisplayConfig displayConfig) {
+ displayConfigs.insert({config, displayConfig});
+ }
+
+ DisplayConfig getDisplayConfig(int32_t config) { return displayConfigs.find(config)->second; }
+
+ private:
+ int64_t mDisplayId;
+ int32_t mDisplayWidth;
+ int32_t mDisplayHeight;
+ std::unordered_map<int32_t, DisplayConfig> displayConfigs;
+};
+} // namespace aidl::android::hardware::graphics::composer3::vts
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 8f8c98f..f9e35e9 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h
@@ -77,10 +77,6 @@
parseSetClientTargetProperty(std::move(
result.get<CommandResultPayload::Tag::clientTargetProperty>()));
break;
- case CommandResultPayload::Tag::bufferAheadResult:
- parseSetBufferAheadResultLayers(
- result.get<CommandResultPayload::Tag::bufferAheadResult>());
- break;
}
}
}
@@ -172,16 +168,6 @@
return std::move(data.clientTargetProperty);
}
- std::vector<BufferAheadResult::Layer> takeBufferAheadResultLayers(int64_t display) {
- const auto found = mReturnData.find(display);
-
- if (found == mReturnData.end()) {
- return {};
- }
-
- return std::move(found->second.bufferAheadResultLayers);
- }
-
private:
void resetData() {
mErrors.clear();
@@ -220,18 +206,12 @@
data.clientTargetProperty = std::move(clientTargetProperty);
}
- void parseSetBufferAheadResultLayers(const BufferAheadResult& bufferAheadResult) {
- auto& data = mReturnData[bufferAheadResult.display];
- data.bufferAheadResultLayers = std::move(bufferAheadResult.layers);
- }
-
struct ReturnData {
DisplayRequest displayRequests;
std::vector<ChangedCompositionLayer> changedLayers;
ndk::ScopedFileDescriptor presentFence;
std::vector<ReleaseFences::Layer> releasedLayers;
PresentOrValidate::Result presentOrValidateState;
- std::vector<BufferAheadResult::Layer> bufferAheadResultLayers;
ClientTargetPropertyWithNits clientTargetProperty = {
.clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN},
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 d429b76..ae17c51 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
@@ -30,7 +30,7 @@
#include <aidl/android/hardware/graphics/composer3/Color.h>
#include <aidl/android/hardware/graphics/composer3/Composition.h>
#include <aidl/android/hardware/graphics/composer3/DisplayBrightness.h>
-#include <aidl/android/hardware/graphics/composer3/Luminance.h>
+#include <aidl/android/hardware/graphics/composer3/LayerBrightness.h>
#include <aidl/android/hardware/graphics/composer3/PerFrameMetadata.h>
#include <aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h>
@@ -131,11 +131,6 @@
getLayerCommand(display, layer).buffer = getBuffer(slot, buffer, acquireFence);
}
- void setLayerBufferAhead(int64_t display, int64_t layer, uint32_t slot,
- const native_handle_t* buffer, int acquireFence) {
- getLayerCommand(display, layer).bufferAhead = getBuffer(slot, buffer, acquireFence);
- }
-
void setLayerSurfaceDamage(int64_t display, int64_t layer, const std::vector<Rect>& damage) {
getLayerCommand(display, layer).damage.emplace(damage.begin(), damage.end());
}
@@ -194,7 +189,7 @@
void setLayerZOrder(int64_t display, int64_t layer, uint32_t z) {
ZOrder zorder;
- zorder.z = z;
+ zorder.z = static_cast<int32_t>(z);
getLayerCommand(display, layer).z.emplace(std::move(zorder));
}
@@ -214,8 +209,9 @@
.perFrameMetadataBlob.emplace(metadata.begin(), metadata.end());
}
- void setLayerWhitePointNits(int64_t display, int64_t layer, float whitePointNits) {
- getLayerCommand(display, layer).whitePointNits.emplace(Luminance{.nits = whitePointNits});
+ void setLayerBrightness(int64_t display, int64_t layer, float brightness) {
+ getLayerCommand(display, layer)
+ .brightness.emplace(LayerBrightness{.brightness = brightness});
}
void setLayerBlockingRegion(int64_t display, int64_t layer, const std::vector<Rect>& blocking) {
@@ -233,9 +229,9 @@
std::optional<LayerCommand> mLayerCommand;
std::vector<DisplayCommand> mCommands;
- Buffer getBuffer(int slot, const native_handle_t* bufferHandle, int fence) {
+ Buffer getBuffer(uint32_t slot, const native_handle_t* bufferHandle, int fence) {
Buffer bufferCommand;
- bufferCommand.slot = slot;
+ bufferCommand.slot = static_cast<int32_t>(slot);
if (bufferHandle) bufferCommand.handle.emplace(::android::dupToAidl(bufferHandle));
if (fence > 0) bufferCommand.fence = ::ndk::ScopedFileDescriptor(fence);
return bufferCommand;
diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp
index 63fdfa6..6c3ef54 100644
--- a/graphics/mapper/2.0/Android.bp
+++ b/graphics/mapper/2.0/Android.bp
@@ -25,4 +25,9 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/mapper/2.1/Android.bp b/graphics/mapper/2.1/Android.bp
index 4011650..cc74156 100644
--- a/graphics/mapper/2.1/Android.bp
+++ b/graphics/mapper/2.1/Android.bp
@@ -26,4 +26,9 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/mapper/3.0/Android.bp b/graphics/mapper/3.0/Android.bp
index 401a3a2..88992a3 100644
--- a/graphics/mapper/3.0/Android.bp
+++ b/graphics/mapper/3.0/Android.bp
@@ -27,4 +27,9 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/graphics/mapper/4.0/Android.bp b/graphics/mapper/4.0/Android.bp
index 4084dcd..0cffce4 100644
--- a/graphics/mapper/4.0/Android.bp
+++ b/graphics/mapper/4.0/Android.bp
@@ -27,4 +27,9 @@
"android.hidl.base@1.0",
],
gen_java: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ ],
}
diff --git a/health/utils/libhealthloop/HealthLoop.cpp b/health/utils/libhealthloop/HealthLoop.cpp
index 3f4b5bc..4190769 100644
--- a/health/utils/libhealthloop/HealthLoop.cpp
+++ b/health/utils/libhealthloop/HealthLoop.cpp
@@ -40,8 +40,6 @@
using namespace android;
using namespace std::chrono_literals;
-#define POWER_SUPPLY_SUBSYSTEM "power_supply"
-
namespace android {
namespace hardware {
namespace health {
@@ -143,7 +141,7 @@
cp = msg;
while (*cp) {
- if (!strcmp(cp, "SUBSYSTEM=" POWER_SUPPLY_SUBSYSTEM)) {
+ if (!strcmp(cp, "SUBSYSTEM=power_supply")) {
ScheduleBatteryUpdate();
break;
}
diff --git a/identity/support/include/cppbor/cppbor.h b/identity/support/include/cppbor/cppbor.h
index a755db1..af5d82e 100644
--- a/identity/support/include/cppbor/cppbor.h
+++ b/identity/support/include/cppbor/cppbor.h
@@ -274,7 +274,7 @@
virtual std::unique_ptr<Item> clone() const override { return std::make_unique<Nint>(mValue); }
private:
- uint64_t addlInfo() const { return -1ll - mValue; }
+ uint64_t addlInfo() const { return -1LL - mValue; }
int64_t mValue;
};
diff --git a/light/aidl/vts/functional/Android.bp b/light/aidl/vts/functional/Android.bp
index c5a8562..16804ea 100644
--- a/light/aidl/vts/functional/Android.bp
+++ b/light/aidl/vts/functional/Android.bp
@@ -36,7 +36,7 @@
"libbinder",
],
static_libs: [
- "android.hardware.light-V1-cpp",
+ "android.hardware.light-V2-cpp",
],
test_suites: [
"vts",
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
index eddf83f..6caac63 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
@@ -203,9 +203,8 @@
}
int64_t delayUs = finishBy - android::ALooper::GetNowUs();
if (delayUs < 0) return toStatus(android::TIMED_OUT);
- (timeoutUs < 0)
- ? msgCondition.wait(msgLock)
- : msgCondition.waitRelative(msgLock, delayUs * 1000ll);
+ (timeoutUs < 0) ? msgCondition.wait(msgLock)
+ : msgCondition.waitRelative(msgLock, delayUs * 1000LL);
}
}
diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/PrepareModelConfig.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/PrepareModelConfig.aidl
index 85c924f..1f44ba7 100644
--- a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/PrepareModelConfig.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/PrepareModelConfig.aidl
@@ -39,7 +39,8 @@
long deadlineNs;
ParcelFileDescriptor[] modelCache;
ParcelFileDescriptor[] dataCache;
- byte[] cacheToken;
+ byte[32] cacheToken;
android.hardware.neuralnetworks.TokenValuePair[] compilationHints;
android.hardware.neuralnetworks.ExtensionNameAndPrefix[] extensionNameToPrefix;
+ const int BYTE_SIZE_OF_CACHE_TOKEN = 32;
}
diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/IDevice.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/IDevice.aidl
index 821b9fe..7808fc2 100644
--- a/neuralnetworks/aidl/android/hardware/neuralnetworks/IDevice.aidl
+++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/IDevice.aidl
@@ -39,7 +39,7 @@
/**
* The byte size of the cache token.
*/
- const int BYTE_SIZE_OF_CACHE_TOKEN = 32;
+ const int BYTE_SIZE_OF_CACHE_TOKEN = PrepareModelConfig.BYTE_SIZE_OF_CACHE_TOKEN;
/**
* The maximum number of files for each type of cache in compilation caching.
*/
diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl
index 949804e..f752750 100644
--- a/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl
+++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl
@@ -204,6 +204,12 @@
* appropriate ErrorStatus value. If the inputs to the function are valid and there is no error,
* createReusableExecution must construct a reusable execution.
*
+ * This method will be called when a client requests a reusable execution with consistent
+ * request and execution config. For single-time execution,
+ * {@link IPreparedModel::executeSynchronouslyWithConfig} or
+ * {@link IPreparedModel::executeFencedWithConfig} is preferred, because the overhead of
+ * setting up a reusable execution can be avoided.
+ *
* @param request The input and output information on which the prepared model is to be
* executed.
* @param config Specifies the execution configuration parameters.
@@ -223,6 +229,10 @@
* ExecutionConfig} instead of a list of configuration parameters, and ExecutionConfig contains
* more configuration parameters than are passed to executeSynchronously.
*
+ * This method is preferred when a client requests a single-time synchronous execution.
+ * For reusable execution with consistent request and execution config,
+ * {@link IPreparedModel::createReusableExecution} must be called.
+ *
* @param request The input and output information on which the prepared model is to be
* executed.
* @param config Specifies the execution configuration parameters.
@@ -246,6 +256,10 @@
* ExecutionConfig} instead of a list of configuration parameters, and ExecutionConfig contains
* more configuration parameters than are passed to executeFenced.
*
+ * This method is preferred when a client requests a single-time fenced execution.
+ * For reusable execution with consistent request and execution config,
+ * {@link IPreparedModel::createReusableExecution} must be called.
+ *
* @param request The input and output information on which the prepared model is to be
* executed. The outputs in the request must have fully specified dimensions.
* @param waitFor A vector of sync fence file descriptors. Execution must not start until all
diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/PrepareModelConfig.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/PrepareModelConfig.aidl
index 96df968..55bd291 100644
--- a/neuralnetworks/aidl/android/hardware/neuralnetworks/PrepareModelConfig.aidl
+++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/PrepareModelConfig.aidl
@@ -28,6 +28,11 @@
@VintfStability
parcelable PrepareModelConfig {
/**
+ * The byte size of the cache token.
+ */
+ const int BYTE_SIZE_OF_CACHE_TOKEN = 32;
+
+ /**
* Indicates the intended execution behavior of a prepared model.
*/
ExecutionPreference preference;
@@ -66,7 +71,7 @@
*/
ParcelFileDescriptor[] dataCache;
/**
- * A caching token of length IDevice::BYTE_SIZE_OF_CACHE_TOKEN identifying
+ * A caching token of length BYTE_SIZE_OF_CACHE_TOKEN identifying
* the prepared model. The same token will be provided when
* retrieving the prepared model from the cache files with
* IDevice::prepareModelFromCache. Tokens should be chosen to have a low
@@ -77,7 +82,7 @@
* indicating that caching information is not provided, this
* token must be ignored.
*/
- byte[] cacheToken;
+ byte[BYTE_SIZE_OF_CACHE_TOKEN] cacheToken;
/**
* A vector of token / value pairs represent vendor specific
* compilation hints or metadata. The provided TokenValuePairs must not
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Conversions.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Conversions.h
index af58715..71a28ef 100644
--- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Conversions.h
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Conversions.h
@@ -27,6 +27,7 @@
#include <aidl/android/hardware/neuralnetworks/Extension.h>
#include <aidl/android/hardware/neuralnetworks/ExtensionNameAndPrefix.h>
#include <aidl/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.h>
+#include <aidl/android/hardware/neuralnetworks/IDevice.h>
#include <aidl/android/hardware/neuralnetworks/Memory.h>
#include <aidl/android/hardware/neuralnetworks/Model.h>
#include <aidl/android/hardware/neuralnetworks/Operand.h>
@@ -219,6 +220,7 @@
#endif // NN_AIDL_V4_OR_ABOVE
nn::GeneralResult<std::vector<int32_t>> toSigned(const std::vector<uint32_t>& vec);
+std::vector<uint8_t> toVec(const std::array<uint8_t, IDevice::BYTE_SIZE_OF_CACHE_TOKEN>& token);
} // namespace aidl::android::hardware::neuralnetworks::utils
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Service.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Service.h
index cb6ff4b..f229165 100644
--- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Service.h
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Service.h
@@ -25,7 +25,8 @@
namespace aidl::android::hardware::neuralnetworks::utils {
-::android::nn::GeneralResult<::android::nn::SharedDevice> getDevice(const std::string& name);
+::android::nn::GeneralResult<::android::nn::SharedDevice> getDevice(
+ const std::string& name, ::android::nn::Version::Level maxFeatureLevelAllowed);
} // namespace aidl::android::hardware::neuralnetworks::utils
diff --git a/neuralnetworks/aidl/utils/src/Conversions.cpp b/neuralnetworks/aidl/utils/src/Conversions.cpp
index 9b897c4..83fda10 100644
--- a/neuralnetworks/aidl/utils/src/Conversions.cpp
+++ b/neuralnetworks/aidl/utils/src/Conversions.cpp
@@ -614,7 +614,7 @@
using Ts::operator()...;
};
template <class... Ts>
-overloaded(Ts...)->overloaded<Ts...>;
+overloaded(Ts...) -> overloaded<Ts...>;
#ifdef __ANDROID__
nn::GeneralResult<common::NativeHandle> aidlHandleFromNativeHandle(
@@ -1190,4 +1190,8 @@
return std::vector<int32_t>(vec.begin(), vec.end());
}
+std::vector<uint8_t> toVec(const std::array<uint8_t, IDevice::BYTE_SIZE_OF_CACHE_TOKEN>& token) {
+ return std::vector<uint8_t>(token.begin(), token.end());
+}
+
} // namespace aidl::android::hardware::neuralnetworks::utils
diff --git a/neuralnetworks/aidl/utils/src/Device.cpp b/neuralnetworks/aidl/utils/src/Device.cpp
index f3f4fdb..b64a40d 100644
--- a/neuralnetworks/aidl/utils/src/Device.cpp
+++ b/neuralnetworks/aidl/utils/src/Device.cpp
@@ -229,7 +229,6 @@
const auto aidlDeadline = NN_TRY(convert(deadline));
auto aidlModelCache = NN_TRY(convert(modelCache));
auto aidlDataCache = NN_TRY(convert(dataCache));
- const auto aidlToken = NN_TRY(convert(token));
const auto cb = ndk::SharedRefBase::make<PreparedModelCallback>(kFeatureLevel);
const auto scoped = kDeathHandler.protectCallback(cb.get());
@@ -240,12 +239,13 @@
const auto ret = kDevice->prepareModelWithConfig(
aidlModel,
{aidlPreference, aidlPriority, aidlDeadline, std::move(aidlModelCache),
- std::move(aidlDataCache), aidlToken, std::move(aidlHints),
+ std::move(aidlDataCache), token, std::move(aidlHints),
std::move(aidlExtensionPrefix)},
cb);
HANDLE_ASTATUS(ret) << "prepareModel failed";
return cb->get();
}
+ const auto aidlToken = NN_TRY(convert(token));
const auto ret = kDevice->prepareModel(aidlModel, aidlPreference, aidlPriority, aidlDeadline,
aidlModelCache, aidlDataCache, aidlToken, cb);
HANDLE_ASTATUS(ret) << "prepareModel failed";
diff --git a/neuralnetworks/aidl/utils/src/InvalidDevice.cpp b/neuralnetworks/aidl/utils/src/InvalidDevice.cpp
index 33270ff..44f8ea9 100644
--- a/neuralnetworks/aidl/utils/src/InvalidDevice.cpp
+++ b/neuralnetworks/aidl/utils/src/InvalidDevice.cpp
@@ -189,7 +189,8 @@
}
}
return prepareModel(model, config.preference, config.priority, config.deadlineNs,
- config.modelCache, config.dataCache, config.cacheToken, callback);
+ config.modelCache, config.dataCache, utils::toVec(config.cacheToken),
+ callback);
}
ndk::ScopedAStatus InvalidDevice::prepareModelFromCache(
diff --git a/neuralnetworks/aidl/utils/src/Service.cpp b/neuralnetworks/aidl/utils/src/Service.cpp
index e48593c..24fbb53 100644
--- a/neuralnetworks/aidl/utils/src/Service.cpp
+++ b/neuralnetworks/aidl/utils/src/Service.cpp
@@ -55,11 +55,12 @@
} // namespace
-nn::GeneralResult<nn::SharedDevice> getDevice(const std::string& instanceName) {
+nn::GeneralResult<nn::SharedDevice> getDevice(
+ const std::string& instanceName, ::android::nn::Version::Level maxFeatureLevelAllowed) {
auto fullName = std::string(IDevice::descriptor) + "/" + instanceName;
hal::utils::ResilientDevice::Factory makeDevice =
- [instanceName,
- name = std::move(fullName)](bool blocking) -> nn::GeneralResult<nn::SharedDevice> {
+ [instanceName, name = std::move(fullName),
+ maxFeatureLevelAllowed](bool blocking) -> nn::GeneralResult<nn::SharedDevice> {
std::add_pointer_t<AIBinder*(const char*)> getService;
if (blocking) {
if (__builtin_available(android __NNAPI_AIDL_MIN_ANDROID_API__, *)) {
@@ -79,7 +80,8 @@
<< " returned nullptr";
}
ABinderProcess_startThreadPool();
- const auto featureLevel = NN_TRY(getAidlServiceFeatureLevel(service.get()));
+ auto featureLevel = NN_TRY(getAidlServiceFeatureLevel(service.get()));
+ featureLevel.level = std::min(featureLevel.level, maxFeatureLevelAllowed);
return Device::create(instanceName, std::move(service), featureLevel);
};
diff --git a/neuralnetworks/aidl/vts/functional/Utils.h b/neuralnetworks/aidl/vts/functional/Utils.h
index 4e0a4aa..ccb0778 100644
--- a/neuralnetworks/aidl/vts/functional/Utils.h
+++ b/neuralnetworks/aidl/vts/functional/Utils.h
@@ -21,6 +21,7 @@
#include <gtest/gtest.h>
#include <algorithm>
+#include <array>
#include <iosfwd>
#include <string>
#include <utility>
@@ -47,6 +48,7 @@
inline constexpr int64_t kOmittedTimeoutDuration = -1;
inline constexpr int64_t kNoDuration = -1;
inline const std::vector<uint8_t> kEmptyCacheToken(IDevice::BYTE_SIZE_OF_CACHE_TOKEN);
+inline const std::array<uint8_t, IDevice::BYTE_SIZE_OF_CACHE_TOKEN> kEmptyCacheTokenArray{};
// Returns the amount of space needed to store a value of the specified type.
//
diff --git a/neuralnetworks/aidl/vts/functional/ValidateModel.cpp b/neuralnetworks/aidl/vts/functional/ValidateModel.cpp
index 931ba25..060434e 100644
--- a/neuralnetworks/aidl/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/aidl/vts/functional/ValidateModel.cpp
@@ -85,7 +85,7 @@
std::shared_ptr<PreparedModelCallback> preparedModelCallback =
ndk::SharedRefBase::make<PreparedModelCallback>();
const auto prepareLaunchStatus = device->prepareModelWithConfig(
- model, {preference, priority, kNoDeadline, {}, {}, kEmptyCacheToken, {}, {}},
+ model, {preference, priority, kNoDeadline, {}, {}, kEmptyCacheTokenArray, {}, {}},
preparedModelCallback);
ASSERT_FALSE(prepareLaunchStatus.isOk());
ASSERT_EQ(prepareLaunchStatus.getExceptionCode(), EX_SERVICE_SPECIFIC);
diff --git a/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
index 51b4805..bf87f15 100644
--- a/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
@@ -72,7 +72,7 @@
kNoDeadline,
{},
{},
- kEmptyCacheToken,
+ kEmptyCacheTokenArray,
{},
{}},
preparedModelCallback);
diff --git a/neuralnetworks/utils/adapter/aidl/src/Device.cpp b/neuralnetworks/utils/adapter/aidl/src/Device.cpp
index 84aaddb..1b90a1a 100644
--- a/neuralnetworks/utils/adapter/aidl/src/Device.cpp
+++ b/neuralnetworks/utils/adapter/aidl/src/Device.cpp
@@ -312,8 +312,8 @@
const std::shared_ptr<IPreparedModelCallback>& callback) {
const auto result = adapter::prepareModel(
kDevice, kExecutor, model, config.preference, config.priority, config.deadlineNs,
- config.modelCache, config.dataCache, config.cacheToken, config.compilationHints,
- config.extensionNameToPrefix, callback);
+ config.modelCache, config.dataCache, utils::toVec(config.cacheToken),
+ config.compilationHints, config.extensionNameToPrefix, callback);
if (!result.has_value()) {
const auto& [message, code] = result.error();
const auto aidlCode = utils::convert(code).value_or(ErrorStatus::GENERAL_FAILURE);
diff --git a/neuralnetworks/utils/service/include/nnapi/hal/Service.h b/neuralnetworks/utils/service/include/nnapi/hal/Service.h
index 2fd5237..e8b9c10 100644
--- a/neuralnetworks/utils/service/include/nnapi/hal/Service.h
+++ b/neuralnetworks/utils/service/include/nnapi/hal/Service.h
@@ -29,7 +29,18 @@
bool isDeviceUpdatable = false;
};
-std::vector<SharedDeviceAndUpdatability> getDevices(bool includeUpdatableDrivers);
+/**
+ * @brief Get the NNAPI sAIDL and HIDL services declared in the VINTF.
+ *
+ * @pre maxFeatureLevelAllowed >= Version::Level::FEATURE_LEVEL_5
+ *
+ * @param includeUpdatableDrivers Allow updatable drivers to be used.
+ * @param maxFeatureLevelAllowed Maximum version of driver allowed to be used. Any driver version
+ * exceeding this must be clamped to `maxFeatureLevelAllowed`.
+ * @return A list of devices and whether each device is updatable or not.
+ */
+std::vector<SharedDeviceAndUpdatability> getDevices(bool includeUpdatableDrivers,
+ nn::Version::Level maxFeatureLevelAllowed);
} // namespace android::hardware::neuralnetworks::service
diff --git a/neuralnetworks/utils/service/src/Service.cpp b/neuralnetworks/utils/service/src/Service.cpp
index 2286288..e0d5f82 100644
--- a/neuralnetworks/utils/service/src/Service.cpp
+++ b/neuralnetworks/utils/service/src/Service.cpp
@@ -74,7 +74,7 @@
void getAidlDevices(std::vector<SharedDeviceAndUpdatability>* devices,
std::unordered_set<std::string>* registeredDevices,
- bool includeUpdatableDrivers) {
+ bool includeUpdatableDrivers, nn::Version::Level maxFeatureLevelAllowed) {
CHECK(devices != nullptr);
CHECK(registeredDevices != nullptr);
@@ -100,7 +100,7 @@
continue;
}
if (const auto [it, unregistered] = registeredDevices->insert(name); unregistered) {
- auto maybeDevice = aidl_hal::utils::getDevice(name);
+ auto maybeDevice = aidl_hal::utils::getDevice(name, maxFeatureLevelAllowed);
if (maybeDevice.has_value()) {
auto device = std::move(maybeDevice).value();
CHECK(device != nullptr);
@@ -116,11 +116,14 @@
} // namespace
-std::vector<SharedDeviceAndUpdatability> getDevices(bool includeUpdatableDrivers) {
+std::vector<SharedDeviceAndUpdatability> getDevices(bool includeUpdatableDrivers,
+ nn::Version::Level maxFeatureLevelAllowed) {
std::vector<SharedDeviceAndUpdatability> devices;
std::unordered_set<std::string> registeredDevices;
- getAidlDevices(&devices, ®isteredDevices, includeUpdatableDrivers);
+ CHECK_GE(maxFeatureLevelAllowed, nn::Version::Level::FEATURE_LEVEL_5);
+
+ getAidlDevices(&devices, ®isteredDevices, includeUpdatableDrivers, maxFeatureLevelAllowed);
getHidlDevicesForVersion(V1_3::IDevice::descriptor, &V1_3::utils::getDevice, &devices,
®isteredDevices);
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
index fe10587..5224624 100644
--- a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
@@ -16,8 +16,37 @@
#include <sap_hidl_hal_utils.h>
+bool isServiceValidForDeviceConfiguration(hidl_string& serviceName) {
+ if (isSsSsEnabled()) {
+ // Device is configured as SSSS.
+ if (serviceName != SAP_SERVICE_SLOT1_NAME) {
+ LOG(DEBUG) << "Not valid for SSSS device.";
+ return false;
+ }
+ } else if (isDsDsEnabled()) {
+ // Device is configured as DSDS.
+ if (serviceName != SAP_SERVICE_SLOT1_NAME && serviceName != SAP_SERVICE_SLOT2_NAME) {
+ LOG(DEBUG) << "Not valid for DSDS device.";
+ return false;
+ }
+ } else if (isTsTsEnabled()) {
+ // Device is configured as TSTS.
+ if (serviceName != SAP_SERVICE_SLOT1_NAME && serviceName != SAP_SERVICE_SLOT2_NAME &&
+ serviceName != SAP_SERVICE_SLOT3_NAME) {
+ LOG(DEBUG) << "Not valid for TSTS device.";
+ return false;
+ }
+ }
+ return true;
+}
+
void SapHidlTest::SetUp() {
- sap = ISap::getService(GetParam());
+ hidl_string serviceName = GetParam();
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ LOG(DEBUG) << "Skipped the test due to device configuration.";
+ GTEST_SKIP();
+ }
+ sap = ISap::getService(serviceName);
ASSERT_NE(sap, nullptr);
sapCb = new SapCallback(*this);
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_utils.h b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
index 2fc9ae3..8e86591 100644
--- a/radio/1.0/vts/functional/sap_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
@@ -36,7 +36,15 @@
using ::android::sp;
#define TIMEOUT_PERIOD 40
-#define SAP_SERVICE_NAME "slot1"
+
+// HAL instance name for SIM slot 1 or single SIM device
+#define SAP_SERVICE_SLOT1_NAME "slot1"
+
+// HAL instance name for SIM slot 2 on dual SIM device
+#define SAP_SERVICE_SLOT2_NAME "slot2"
+
+// HAL instance name for SIM slot 3 on triple SIM device
+#define SAP_SERVICE_SLOT3_NAME "slot3"
class SapHidlTest;
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h
index bbfff61..89ddea0 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h
@@ -39,8 +39,6 @@
const sp<RadioConfigResponse> mRadioConfigResponse;
const sp<RadioConfigIndication> mRadioConfigIndication;
- std::shared_ptr<::aidl::android::hardware::radio::config::IRadioConfigResponse> respond();
-
::ndk::ScopedAStatus getHalDeviceCapabilities(int32_t serial) override;
::ndk::ScopedAStatus getNumOfLiveModems(int32_t serial) override;
::ndk::ScopedAStatus getPhoneCapability(int32_t serial) override;
@@ -57,6 +55,9 @@
const std::vector<aidl::android::hardware::radio::config::SlotPortMapping>& slotMap)
override;
+ protected:
+ std::shared_ptr<::aidl::android::hardware::radio::config::IRadioConfigResponse> respond();
+
public:
/**
* Constructs AIDL IRadioConfig instance wrapping existing HIDL IRadioConfig instance.
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h
index c2c0de3..da19811 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h
@@ -22,8 +22,6 @@
namespace android::hardware::radio::compat {
class RadioData : public RadioCompatBase, public aidl::android::hardware::radio::data::BnRadioData {
- std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> respond();
-
::ndk::ScopedAStatus allocatePduSessionId(int32_t serial) override;
::ndk::ScopedAStatus cancelHandover(int32_t serial, int32_t callId) override;
::ndk::ScopedAStatus deactivateDataCall(
@@ -65,6 +63,9 @@
const ::aidl::android::hardware::radio::data::KeepaliveRequest& keepalive) override;
::ndk::ScopedAStatus stopKeepalive(int32_t serial, int32_t sessionHandle) override;
+ protected:
+ std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> respond();
+
public:
using RadioCompatBase::RadioCompatBase;
};
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h
index 047f836..1af406a 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h
@@ -23,8 +23,6 @@
class RadioMessaging : public RadioCompatBase,
public aidl::android::hardware::radio::messaging::BnRadioMessaging {
- std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> respond();
-
::ndk::ScopedAStatus acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success,
const std::string& ackPdu) override;
::ndk::ScopedAStatus acknowledgeLastIncomingCdmaSms(
@@ -82,6 +80,9 @@
int32_t serial,
const ::aidl::android::hardware::radio::messaging::SmsWriteArgs& smsWriteArgs) override;
+ protected:
+ std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> respond();
+
public:
using RadioCompatBase::RadioCompatBase;
};
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h
index fdca124..beb1fb0 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h
@@ -23,8 +23,6 @@
class RadioModem : public RadioCompatBase,
public aidl::android::hardware::radio::modem::BnRadioModem {
- std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse> respond();
-
::ndk::ScopedAStatus enableModem(int32_t serial, bool on) override;
::ndk::ScopedAStatus getBasebandVersion(int32_t serial) override;
::ndk::ScopedAStatus getDeviceIdentity(int32_t serial) override;
@@ -54,6 +52,9 @@
const std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemIndication>&
radioModemIndication) override;
+ protected:
+ std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse> respond();
+
public:
using RadioCompatBase::RadioCompatBase;
};
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
index 1731b78..9784665 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
@@ -23,8 +23,6 @@
class RadioNetwork : public RadioCompatBase,
public aidl::android::hardware::radio::network::BnRadioNetwork {
- std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond();
-
::ndk::ScopedAStatus getAllowedNetworkTypesBitmap(int32_t serial) override;
::ndk::ScopedAStatus getAvailableBandModes(int32_t serial) override;
::ndk::ScopedAStatus getAvailableNetworks(int32_t serial) override;
@@ -92,6 +90,9 @@
::aidl::android::hardware::radio::network::UsageSetting usageSetting) override;
::ndk::ScopedAStatus getUsageSetting(int32_t serial) override;
+ protected:
+ std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond();
+
public:
using RadioCompatBase::RadioCompatBase;
};
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h
index 84bb68b..ff91aef 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h
@@ -22,8 +22,6 @@
namespace android::hardware::radio::compat {
class RadioSim : public RadioCompatBase, public aidl::android::hardware::radio::sim::BnRadioSim {
- std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> respond();
-
::ndk::ScopedAStatus areUiccApplicationsEnabled(int32_t serial) override;
::ndk::ScopedAStatus changeIccPin2ForApp(int32_t serial, const std::string& oldPin2,
const std::string& newPin2,
@@ -102,6 +100,9 @@
int32_t serial,
const ::aidl::android::hardware::radio::sim::PhonebookRecordInfo& recordInfo) override;
+ protected:
+ std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> respond();
+
public:
using RadioCompatBase::RadioCompatBase;
};
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
index 0f1d5fd..7bc998e 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h
@@ -23,8 +23,6 @@
class RadioVoice : public RadioCompatBase,
public aidl::android::hardware::radio::voice::BnRadioVoice {
- std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> respond();
-
::ndk::ScopedAStatus acceptCall(int32_t serial) override;
::ndk::ScopedAStatus cancelPendingUssd(int32_t serial) override;
::ndk::ScopedAStatus conference(int32_t serial) override;
@@ -80,6 +78,9 @@
::ndk::ScopedAStatus stopDtmf(int32_t serial) override;
::ndk::ScopedAStatus switchWaitingOrHoldingAndActive(int32_t serial) override;
+ protected:
+ std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> respond();
+
public:
using RadioCompatBase::RadioCompatBase;
};
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index 391d63c..e1d508d 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -264,11 +264,16 @@
[&](int serial) { return radio_network->setUsageSetting(serial, originalSetting); },
{RadioError::NONE});
+ // After resetting the value to its original value, update the local cache, which must
+ // always succeed.
+ invokeAndExpectResponse([&](int serial) { return radio_network->getUsageSetting(serial); },
+ {RadioError::NONE});
+
// Check that indeed the updated setting was set. We do this after resetting to original
// conditions to avoid early-exiting the test and leaving the device in a modified state.
- ASSERT_TRUE(expectedSetting == updatedSetting);
+ EXPECT_EQ(expectedSetting, updatedSetting);
// Check that indeed the original setting was reset.
- ASSERT_TRUE(originalSetting == radioRsp_network->usageSetting);
+ EXPECT_EQ(originalSetting, radioRsp_network->usageSetting);
}
/*
@@ -1728,4 +1733,4 @@
RadioError::PASSWORD_INCORRECT, RadioError::SIM_ABSENT, RadioError::SYSTEM_ERR}));
}
LOG(DEBUG) << "supplyNetworkDepersonalization finished";
-}
\ No newline at end of file
+}
diff --git a/security/dice/aidl/Android.bp b/security/dice/aidl/Android.bp
index 01bc91e..8c31e26 100644
--- a/security/dice/aidl/Android.bp
+++ b/security/dice/aidl/Android.bp
@@ -38,6 +38,10 @@
enabled: true,
},
apps_enabled: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.compos",
+ ],
},
rust: {
enabled: true,
diff --git a/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl b/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl
index 153a04f..abb2a7b 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl
@@ -40,7 +40,9 @@
* "vb_state" : "green" / "yellow" / "orange", // Taken from the AVB values
* "bootloader_state" : "locked" / "unlocked", // Taken from the AVB values
* "vbmeta_digest": bstr, // Taken from the AVB values
- * "os_version" : tstr, // Same as android.os.Build.VERSION.release
+ * ? "os_version" : tstr, // Same as
+ * // android.os.Build.VERSION.release
+ * // Not optional for TEE.
* "system_patch_level" : uint, // YYYYMMDD
* "boot_patch_level" : uint, // YYYYMMDD
* "vendor_patch_level" : uint, // YYYYMMDD
diff --git a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index 927d7d7..e2d75ce 100644
--- a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -492,7 +492,6 @@
ASSERT_NE(allowList.find(deviceInfo->get("bootloader_state")->asTstr()->value()),
allowList.end());
checkType(deviceInfo, cppbor::BSTR, "vbmeta_digest");
- checkType(deviceInfo, cppbor::TSTR, "os_version");
checkType(deviceInfo, cppbor::UINT, "system_patch_level");
checkType(deviceInfo, cppbor::UINT, "boot_patch_level");
checkType(deviceInfo, cppbor::UINT, "vendor_patch_level");
@@ -502,6 +501,9 @@
allowList = getAllowedSecurityLevels();
ASSERT_NE(allowList.find(deviceInfo->get("security_level")->asTstr()->value()),
allowList.end());
+ if (deviceInfo->get("security_level")->asTstr()->value() == "tee") {
+ checkType(deviceInfo, cppbor::TSTR, "os_version");
+ }
break;
case 1:
checkType(deviceInfo, cppbor::TSTR, "security_level");
diff --git a/sensors/aidl/android/hardware/sensors/Event.aidl b/sensors/aidl/android/hardware/sensors/Event.aidl
index e8550f1..b95299c 100644
--- a/sensors/aidl/android/hardware/sensors/Event.aidl
+++ b/sensors/aidl/android/hardware/sensors/Event.aidl
@@ -204,6 +204,8 @@
* velocity of the head (relative to itself), in radians per second.
* The direction of this vector indicates the axis of rotation, and
* the magnitude indicates the rate of rotation.
+ * If this head tracker sensor instance does not support detecting
+ * velocity, then these fields must be set to 0.
*/
float vx;
float vy;
diff --git a/sensors/aidl/default/Sensor.cpp b/sensors/aidl/default/Sensor.cpp
index 50d8841..62193d6 100644
--- a/sensors/aidl/default/Sensor.cpp
+++ b/sensors/aidl/default/Sensor.cpp
@@ -52,10 +52,10 @@
}
void Sensor::batch(int64_t samplingPeriodNs) {
- if (samplingPeriodNs < mSensorInfo.minDelayUs * 1000ll) {
- samplingPeriodNs = mSensorInfo.minDelayUs * 1000ll;
- } else if (samplingPeriodNs > mSensorInfo.maxDelayUs * 1000ll) {
- samplingPeriodNs = mSensorInfo.maxDelayUs * 1000ll;
+ if (samplingPeriodNs < mSensorInfo.minDelayUs * 1000LL) {
+ samplingPeriodNs = mSensorInfo.minDelayUs * 1000LL;
+ } else if (samplingPeriodNs > mSensorInfo.maxDelayUs * 1000LL) {
+ samplingPeriodNs = mSensorInfo.maxDelayUs * 1000LL;
}
if (mSamplingPeriodNs != samplingPeriodNs) {
diff --git a/sensors/common/default/2.X/Sensor.cpp b/sensors/common/default/2.X/Sensor.cpp
index 23c9803..fd701fd 100644
--- a/sensors/common/default/2.X/Sensor.cpp
+++ b/sensors/common/default/2.X/Sensor.cpp
@@ -59,10 +59,10 @@
}
void Sensor::batch(int64_t samplingPeriodNs) {
- if (samplingPeriodNs < mSensorInfo.minDelay * 1000ll) {
- samplingPeriodNs = mSensorInfo.minDelay * 1000ll;
- } else if (samplingPeriodNs > mSensorInfo.maxDelay * 1000ll) {
- samplingPeriodNs = mSensorInfo.maxDelay * 1000ll;
+ if (samplingPeriodNs < mSensorInfo.minDelay * 1000LL) {
+ samplingPeriodNs = mSensorInfo.minDelay * 1000LL;
+ } else if (samplingPeriodNs > mSensorInfo.maxDelay * 1000LL) {
+ samplingPeriodNs = mSensorInfo.maxDelay * 1000LL;
}
if (mSamplingPeriodNs != samplingPeriodNs) {
diff --git a/tv/Android.mk b/tv/Android.mk
new file mode 100644
index 0000000..d78614a
--- /dev/null
+++ b/tv/Android.mk
@@ -0,0 +1,2 @@
+$(eval $(call declare-1p-copy-files,hardware/interfaces/tv,tuner_vts_config_1_0.xml))
+$(eval $(call declare-1p-copy-files,hardware/interfaces/tv,tuner_vts_config_1_1.xml))
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl
index 12f2692..9cbd3dd 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/IFrontend.aidl
@@ -142,7 +142,9 @@
* Request Hardware information about the frontend.
*
* The client may use this to collect vendor specific hardware information, e.g. RF
- * chip version, Demod chip version, detailed status of dvbs blind scan, etc.
+ * chip version, Demod chip version, detailed status of dvbs blind scan, etc. The
+ * client shouldn’t parse things or rely on any format or change their behavior
+ * based on results.
*
* @return the frontend hardware information.
*/
diff --git a/update-base-files.sh b/update-base-files.sh
index d01847d..bf7f6e4 100755
--- a/update-base-files.sh
+++ b/update-base-files.sh
@@ -45,8 +45,11 @@
-o $ANDROID_BUILD_TOP/system/media/audio/include/system/audio_common-base.h \
android.hardware.audio.common@7.0
hidl-gen $options \
- -o $ANDROID_BUILD_TOP/system/media/audio/include/system/audio-base.h \
+ -o $ANDROID_BUILD_TOP/system/media/audio/include/system/audio-base-v7.0.h \
android.hardware.audio@7.0
hidl-gen $options \
+ -o $ANDROID_BUILD_TOP/system/media/audio/include/system/audio-base-v7.1.h \
+ android.hardware.audio@7.1
+hidl-gen $options \
-o $ANDROID_BUILD_TOP/system/media/audio/include/system/audio_effect-base.h \
android.hardware.audio.effect@7.0
diff --git a/usb/aidl/Android.bp b/usb/aidl/Android.bp
index d1e9e68..f71cacb 100644
--- a/usb/aidl/Android.bp
+++ b/usb/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.usb",
vendor_available: true,
diff --git a/usb/aidl/default/Android.bp b/usb/aidl/default/Android.bp
index da0cff2..7cb2822 100644
--- a/usb/aidl/default/Android.bp
+++ b/usb/aidl/default/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_binary {
name: "android.hardware.usb-service.example",
relative_install_path: "hw",
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 fec044e..cbe2068 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
@@ -35,14 +35,13 @@
@Backing(type="int") @VintfStability
enum UwbVendorCapabilityTlvTypes {
SUPPORTED_POWER_STATS_QUERY = 192,
- CCC_SUPPORTED_VERSIONS = 160,
- CCC_SUPPORTED_UWB_CONFIGS = 161,
- CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 162,
- CCC_SUPPORTED_RAN_MULTIPLIER = 163,
- CCC_SUPPORTED_CHAPS_PER_SLOT = 164,
- CCC_SUPPORTED_SYNC_CODES = 165,
- CCC_SUPPORTED_CHANNELS = 166,
- CCC_SUPPORTED_HOPPING_SEQUENCES = 167,
- CCC_SUPPORTED_HOPPING_CONFIG_MODES = 168,
+ 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,
SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227,
}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
index ee47a13..0e33f70 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
@@ -36,19 +36,21 @@
enum UwbVendorCapabilityTlvValues {
UWB_CONFIG_0 = 0,
UWB_CONFIG_1 = 1,
- PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 1,
- PULSE_SHAPE_PRECURSOR_FREE = 2,
- PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3,
- CHAPS_PER_SLOT_3 = 3,
- CHAPS_PER_SLOT_4 = 4,
- CHAPS_PER_SLOT_6 = 6,
+ 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 = 9,
- CHAPS_PER_SLOT_12 = 12,
- CHAPS_PER_SLOT_24 = 24,
- HOPPING_SEQUENCE_DEFAULT = 0,
- HOPPING_SEQUENCE_AES = 1,
- HOPPING_CONFIG_MODE_NONE = 0,
- HOPPING_CONFIG_MODE_CONTINUOUS = 1,
- HOPPING_CONFIG_MODE_ADAPTIVE = 2,
+ 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/current/android/hardware/uwb/fira_android/UwbVendorGids.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGids.aidl
index b0d88e0..5515c67 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGids.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGids.aidl
@@ -34,5 +34,5 @@
package android.hardware.uwb.fira_android;
@Backing(type="byte") @VintfStability
enum UwbVendorGids {
- ANDROID = 14,
+ ANDROID = 12,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
index 4591dda..97f8010 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -46,17 +46,85 @@
********************************************/
/**
+ * 1 byte bitmask with a list of supported chaps per slot
+ * Bitmap of supported values of Slot durations as a multiple of TChap,
+ * NChap_per_Slot as defined in CCC Specification.
+ * Each “1” in this bit map corresponds to a specific
+ * value of NChap_per_Slot where:
+ * 0x01 = “3”,
+ * 0x02 = “4”,
+ * 0x04= “6”,
+ * 0x08 =“8”,
+ * 0x10 =“9”,
+ * 0x20 = “12”,
+ * 0x40 = “24”,
+ * 0x80 is reserved.
+ */
+ CCC_SUPPORTED_CHAPS_PER_SLOT = 0xA0,
+
+ /**
+ * 4 byte bitmask with a list of supported sync codes
+ * Bitmap of SYNC code indices that can be used.
+ * The position of each “1” in this bit pattern
+ * corresponds to the index of a SYNC code that
+ * can be used, where:
+ * 0x00000001 = “1”,
+ * 0x00000002 = “2”,
+ * 0x00000004 = “3”,
+ * 0x00000008 = “4”,
+ * ….
+ * 0x40000000 = “31”,
+ * 0x80000000 = “32”
+ * Refer to IEEE 802.15.4-2015 and CCC
+ * Specification for SYNC code index definition
+ */
+ CCC_SUPPORTED_SYNC_CODES = 0xA1,
+
+ /**
+ * 1 byte bitmask with a list of supported hopping config modes and sequences.
+ * [b7 b6 b5] : bitmask of hopping modes the
+ * device offers to use in the ranging session
+ * 100 - No Hopping
+ * 010 - Continuous Hopping
+ * 001 - Adaptive Hopping
+ * [b4 b3 b2 b1 b0] : bit mask of hopping
+ * sequences the device offers to use in the
+ * ranging session
+ * b4=1 is always set because of the default
+ * hopping sequence. Support for it is mandatory.
+ * b3=1 is set when the optional AES based
+ * hopping sequence is supported.
+ */
+ CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES = 0xA2,
+
+ /**
+ * 1 byte bitmask with list of supported channels
+ * Bitmap of supported UWB channels. Each “1” in
+ * this bit map corresponds to a specific value of
+ * UWB channel where:
+ * 0x01 = "Channel 5"
+ * 0x02 = "Channel 9"
+ */
+ CCC_SUPPORTED_CHANNELS = 0xA3,
+
+ /**
* 2 byte tuple {major_version (1 byte), minor_version (1 byte)} array with list of supported
* CCC versions
*/
- CCC_SUPPORTED_VERSIONS = 0xA0,
+ CCC_SUPPORTED_VERSIONS = 0xA4,
+
/**
* byte array with a list of supported UWB configs
- * Values:
- * UWB_CONFIG_0 = 0
- * UWB_CONFIG_1 = 1
+ *
+ * UWB configurations are define in chapter
+ * "21.4 UWB Frame Elements" of the CCC
+ * specification. Configuration 0x0000 is
+ * mandatory for device and vehicle, configuration
+ * 0x0001 is mandatory for the device, optional for
+ * the vehicle.
*/
- CCC_SUPPORTED_UWB_CONFIGS = 0xA1,
+ CCC_SUPPORTED_UWB_CONFIGS = 0xA5,
+
/**
* 1 byte tuple {initiator_tx (4 bits), responder_tx (4 bits)} array with list of supported
* pulse shape combos
@@ -66,43 +134,10 @@
* PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3
*/
/** */
- CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 0xA2,
+ CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 0xA6,
+
/** Int value for indicating supported ran multiplier */
- CCC_SUPPORTED_RAN_MULTIPLIER = 0xA3,
- /**
- * byte array with a list of supported chaps per slot
- * Values:
- * CHAPS_PER_SLOT_3 = 3
- * CHAPS_PER_SLOT_4 = 4
- * CHAPS_PER_SLOT_6 = 6
- * CHAPS_PER_SLOT_8 = 8
- * CHAPS_PER_SLOT_9 = 9
- * CHAPS_PER_SLOT_12 = 12
- * CHAPS_PER_SLOT_24 = 24
- */
- CCC_SUPPORTED_CHAPS_PER_SLOT = 0xA4,
- /**
- * byte array with a list of supported sync codes
- * Values: 1 - 32
- */
- CCC_SUPPORTED_SYNC_CODES = 0xA5,
- /** byte array with list of supported channels */
- CCC_SUPPORTED_CHANNELS = 0xA6,
- /**
- * byte array with a list of supported hopping sequences
- * Values:
- HOPPING_SEQUENCE_DEFAULT = 0
- HOPPING_SEQUENCE_AES = 1
- */
- CCC_SUPPORTED_HOPPING_SEQUENCES = 0xA7,
- /**
- * byte array with a list of supported hopping config modes
- * Values:
- * HOPPING_CONFIG_MODE_NONE = 0
- * HOPPING_CONFIG_MODE_CONTINUOUS = 1
- * HOPPING_CONFIG_MODE_ADAPTIVE = 2
- */
- CCC_SUPPORTED_HOPPING_CONFIG_MODES = 0xA8,
+ CCC_SUPPORTED_RAN_MULTIPLIER = 0xA7,
/*********************************************
* FIRA specific
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
index 380089f..7c86b79 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
@@ -30,22 +30,25 @@
UWB_CONFIG_0 = 0,
UWB_CONFIG_1 = 1,
- PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 1,
- PULSE_SHAPE_PRECURSOR_FREE = 2,
- PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3,
+ PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 0,
+ PULSE_SHAPE_PRECURSOR_FREE = 1,
+ PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 2,
- CHAPS_PER_SLOT_3 = 3,
- CHAPS_PER_SLOT_4 = 4,
- CHAPS_PER_SLOT_6 = 6,
- CHAPS_PER_SLOT_8 = 8,
- CHAPS_PER_SLOT_9 = 9,
- CHAPS_PER_SLOT_12 = 12,
- CHAPS_PER_SLOT_24 = 24,
+ CHAPS_PER_SLOT_3 = 1,
+ CHAPS_PER_SLOT_4 = 1 << 1,
+ CHAPS_PER_SLOT_6 = 1 << 2,
+ CHAPS_PER_SLOT_8 = 1 << 3,
+ CHAPS_PER_SLOT_9 = 1 << 4,
+ CHAPS_PER_SLOT_12 = 1 << 5,
+ CHAPS_PER_SLOT_24 = 1 << 6,
- HOPPING_SEQUENCE_DEFAULT = 0,
- HOPPING_SEQUENCE_AES = 1,
+ HOPPING_SEQUENCE_DEFAULT = 1 << 4,
+ HOPPING_SEQUENCE_AES = 1 << 3,
- HOPPING_CONFIG_MODE_NONE = 0,
- HOPPING_CONFIG_MODE_CONTINUOUS = 1,
- HOPPING_CONFIG_MODE_ADAPTIVE = 2,
+ HOPPING_CONFIG_MODE_NONE = 1 << 7,
+ HOPPING_CONFIG_MODE_CONTINUOUS = 1 << 6,
+ HOPPING_CONFIG_MODE_ADAPTIVE = 1 << 5,
+
+ CCC_CHANNEL_5 = 1,
+ CCC_CHANNEL_9 = 1 << 1,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
index c04bdcf..e389a2d 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
@@ -19,6 +19,7 @@
/**
* Android specific vendor command OIDs should be defined here.
*
+ * For use with Android GID - 0xC.
*/
@VintfStability
@Backing(type="byte")
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGids.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGids.aidl
index c7bc6b0..dbe00cb 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGids.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGids.aidl
@@ -32,5 +32,5 @@
*/
/** All Android specific commands/response/notification should use this GID */
- ANDROID = 0xE,
+ ANDROID = 0xC,
}
diff --git a/vibrator/aidl/OWNERS b/vibrator/aidl/OWNERS
index ae10db6..3982c7b 100644
--- a/vibrator/aidl/OWNERS
+++ b/vibrator/aidl/OWNERS
@@ -1,4 +1,4 @@
# Bug component: 345036
include platform/frameworks/base:/services/core/java/com/android/server/vibrator/OWNERS
chasewu@google.com
-leungv@google.com
+taikuo@google.com
diff --git a/wifi/1.6/IWifiChip.hal b/wifi/1.6/IWifiChip.hal
index 555ec91..726839d 100644
--- a/wifi/1.6/IWifiChip.hal
+++ b/wifi/1.6/IWifiChip.hal
@@ -16,6 +16,7 @@
package android.hardware.wifi@1.6;
+import @1.0::ChipModeId;
import @1.0::IWifiIface;
import @1.0::WifiStatus;
import @1.5::WifiBand;
@@ -101,6 +102,107 @@
generates (WifiStatus status, vec<WifiUsableChannel> channels);
/**
+ * Set of interface concurrency types with the maximum number of interfaces that can have
+ * one of the specified concurrency types for a given ChipConcurrencyCombination. See
+ * ChipConcurrencyCombination for examples.
+ */
+ struct ChipConcurrencyCombinationLimit {
+ // Each IfaceConcurrencyType must occur at most once.
+ vec<IfaceConcurrencyType> types;
+ uint32_t maxIfaces;
+ };
+
+ /**
+ * Set of interfaces that can operate concurrently when in a given mode. See
+ * ChipMode below.
+ *
+ * For example:
+ * [{STA} <= 2]
+ * At most two STA interfaces are supported
+ * [], [STA], [STA+STA]
+ *
+ * [{STA} <= 1, {NAN} <= 1, {AP_BRIDGED} <= 1]
+ * Any combination of STA, NAN, AP_BRIDGED
+ * [], [STA], [NAN], [AP_BRIDGED], [STA+NAN], [STA+AP_BRIDGED], [NAN+AP_BRIDGED],
+ * [STA+NAN+AP_BRIDGED]
+ *
+ * [{STA} <= 1, {NAN,P2P} <= 1]
+ * Optionally a STA and either NAN or P2P
+ * [], [STA], [STA+NAN], [STA+P2P], [NAN], [P2P]
+ * Not included [NAN+P2P], [STA+NAN+P2P]
+ *
+ * [{STA} <= 1, {STA,NAN} <= 1]
+ * Optionally a STA and either a second STA or a NAN
+ * [], [STA], [STA+NAN], [STA+STA], [NAN]
+ * Not included [STA+STA+NAN]
+ */
+ struct ChipConcurrencyCombination {
+ vec<ChipConcurrencyCombinationLimit> limits;
+ };
+
+ /**
+ * A mode that the chip can be put in. A mode defines a set of constraints on
+ * the interfaces that can exist while in that mode. Modes define a unit of
+ * configuration where all interfaces must be torn down to switch to a
+ * different mode. Some HALs may only have a single mode, but an example where
+ * multiple modes would be required is if a chip has different firmwares with
+ * different capabilities.
+ *
+ * When in a mode, it must be possible to perform any combination of creating
+ * and removing interfaces as long as at least one of the
+ * ChipConcurrencyCombinations is satisfied. This means that if a chip has two
+ * available combinations, [{STA} <= 1] and [{AP_BRIDGED} <= 1] then it is expected
+ * that exactly one STA type or one AP_BRIDGED type can be created, but it
+ * is not expected that both a STA and AP_BRIDGED type could be created. If it
+ * was then there would be a single available combination
+ * [{STA} <=1, {AP_BRIDGED} <= 1].
+ *
+ * When switching between two available combinations it is expected that
+ * interfaces only supported by the initial combination must be removed until
+ * the target combination is also satisfied. At that point new interfaces
+ * satisfying only the target combination can be added (meaning the initial
+ * combination limits will no longer satisfied). The addition of these new
+ * interfaces must not impact the existence of interfaces that satisfy both
+ * combinations.
+ *
+ * For example, a chip with available combinations:
+ * [{STA} <= 2, {NAN} <=1] and [{STA} <=1, {NAN} <= 1, {AP_BRIDGED} <= 1}]
+ * If the chip currently has 3 interfaces STA, STA and NAN and wants to add an
+ * AP_BRIDGED interface in place of one of the STAs then first one of the STA
+ * interfaces must be removed and then the AP interface can be created after
+ * the STA had been torn down. During this process the remaining STA and NAN
+ * interfaces must not be removed/recreated.
+ *
+ * If a chip does not support this kind of reconfiguration in this mode then
+ * the combinations must be separated into two separate modes. Before
+ * switching modes all interfaces must be torn down, the mode switch must be
+ * enacted and when it completes the new interfaces must be brought up.
+ */
+ struct ChipMode {
+ /**
+ * Id that can be used to put the chip in this mode.
+ */
+ ChipModeId id;
+
+ /**
+ * A list of the possible interface concurrency type combinations that the chip can have
+ * while in this mode.
+ */
+ vec<ChipConcurrencyCombination> availableCombinations;
+ };
+
+ /**
+ * Get the set of operation modes that the chip supports.
+ *
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
+ * @return modes List of modes supported by the device.
+ */
+ getAvailableModes_1_6() generates (WifiStatus status, vec<ChipMode> modes);
+
+ /**
* Retrieve the list of all the possible radio combinations supported by this
* chip.
*
diff --git a/wifi/1.6/default/tests/mock_wifi_feature_flags.h b/wifi/1.6/default/tests/mock_wifi_feature_flags.h
index fa3600a..fbe1f7a 100644
--- a/wifi/1.6/default/tests/mock_wifi_feature_flags.h
+++ b/wifi/1.6/default/tests/mock_wifi_feature_flags.h
@@ -33,7 +33,7 @@
public:
MockWifiFeatureFlags();
- MOCK_METHOD1(getChipModes, std::vector<V1_0::IWifiChip::ChipMode>(bool is_primary));
+ MOCK_METHOD1(getChipModes, std::vector<V1_6::IWifiChip::ChipMode>(bool is_primary));
MOCK_METHOD0(isApMacRandomizationDisabled, bool());
};
diff --git a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp
index 542b180..48c0065 100644
--- a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp
+++ b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp
@@ -48,13 +48,13 @@
protected:
void setupV1IfaceCombination() {
// clang-format off
- const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = {
- {{{{IfaceType::STA}, 1}, {{IfaceType::P2P}, 1}}}
+ const hidl_vec<IWifiChip::ChipConcurrencyCombination> combinationsSta = {
+ {{{{IfaceConcurrencyType::STA}, 1}, {{IfaceConcurrencyType::P2P}, 1}}}
};
- const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsAp = {
- {{{{IfaceType::AP}, 1}}}
+ const hidl_vec<IWifiChip::ChipConcurrencyCombination> combinationsAp = {
+ {{{{IfaceConcurrencyType::AP}, 1}}}
};
- const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+ const std::vector<V1_6::IWifiChip::ChipMode> modes = {
{feature_flags::chip_mode_ids::kV1Sta, combinationsSta},
{feature_flags::chip_mode_ids::kV1Ap, combinationsAp}
};
@@ -64,13 +64,14 @@
void setupV1_AwareIfaceCombination() {
// clang-format off
- const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = {
- {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}}
+ const hidl_vec<IWifiChip::ChipConcurrencyCombination> combinationsSta = {
+ {{{{IfaceConcurrencyType::STA}, 1},
+ {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}}
};
- const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsAp = {
- {{{{IfaceType::AP}, 1}}}
+ const hidl_vec<IWifiChip::ChipConcurrencyCombination> combinationsAp = {
+ {{{{IfaceConcurrencyType::AP}, 1}}}
};
- const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+ const std::vector<V1_6::IWifiChip::ChipMode> modes = {
{feature_flags::chip_mode_ids::kV1Sta, combinationsSta},
{feature_flags::chip_mode_ids::kV1Ap, combinationsAp}
};
@@ -80,10 +81,11 @@
void setupV1_AwareDisabledApIfaceCombination() {
// clang-format off
- const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = {
- {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}}
+ const hidl_vec<IWifiChip::ChipConcurrencyCombination> combinationsSta = {
+ {{{{IfaceConcurrencyType::STA}, 1},
+ {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}}
};
- const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+ const std::vector<V1_6::IWifiChip::ChipMode> modes = {
{feature_flags::chip_mode_ids::kV1Sta, combinationsSta}
};
// clang-format on
@@ -92,11 +94,12 @@
void setupV2_AwareIfaceCombination() {
// clang-format off
- const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = {
- {{{{IfaceType::STA}, 1}, {{IfaceType::AP}, 1}}},
- {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}}
+ const hidl_vec<IWifiChip::ChipConcurrencyCombination> combinations = {
+ {{{{IfaceConcurrencyType::STA}, 1}, {{IfaceConcurrencyType::AP}, 1}}},
+ {{{{IfaceConcurrencyType::STA}, 1},
+ {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}}
};
- const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+ const std::vector<V1_6::IWifiChip::ChipMode> modes = {
{feature_flags::chip_mode_ids::kV3, combinations}
};
// clang-format on
@@ -105,10 +108,11 @@
void setupV2_AwareDisabledApIfaceCombination() {
// clang-format off
- const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = {
- {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}}
+ const hidl_vec<IWifiChip::ChipConcurrencyCombination> combinations = {
+ {{{{IfaceConcurrencyType::STA}, 1},
+ {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}}
};
- const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+ const std::vector<V1_6::IWifiChip::ChipMode> modes = {
{feature_flags::chip_mode_ids::kV3, combinations}
};
// clang-format on
@@ -117,10 +121,10 @@
void setup_MultiIfaceCombination() {
// clang-format off
- const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = {
- {{{{IfaceType::STA}, 3}, {{IfaceType::AP}, 1}}}
+ const hidl_vec<IWifiChip::ChipConcurrencyCombination> combinations = {
+ {{{{IfaceConcurrencyType::STA}, 3}, {{IfaceConcurrencyType::AP}, 1}}}
};
- const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+ const std::vector<V1_6::IWifiChip::ChipMode> modes = {
{feature_flags::chip_mode_ids::kV3, combinations}
};
// clang-format on
@@ -128,19 +132,20 @@
}
void assertNumberOfModes(uint32_t num_modes) {
- chip_->getAvailableModes([num_modes](const WifiStatus& status,
- const std::vector<WifiChip::ChipMode>& modes) {
+ chip_->getAvailableModes_1_6([num_modes](const WifiStatus& status,
+ const std::vector<WifiChip::ChipMode>& modes) {
ASSERT_EQ(WifiStatusCode::SUCCESS, status.code);
// V2_Aware has 1 mode of operation.
ASSERT_EQ(num_modes, modes.size());
});
}
- void findModeAndConfigureForIfaceType(const IfaceType& type) {
+ void findModeAndConfigureForIfaceType(const IfaceConcurrencyType& type) {
// This should be aligned with kInvalidModeId in wifi_chip.cpp.
ChipModeId mode_id = UINT32_MAX;
- chip_->getAvailableModes([&mode_id, &type](const WifiStatus& status,
- const std::vector<WifiChip::ChipMode>& modes) {
+ chip_->getAvailableModes_1_6([&mode_id, &type](
+ const WifiStatus& status,
+ const std::vector<WifiChip::ChipMode>& modes) {
ASSERT_EQ(WifiStatusCode::SUCCESS, status.code);
for (const auto& mode : modes) {
for (const auto& combination : mode.availableCombinations) {
@@ -298,48 +303,48 @@
};
TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
}
TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::P2P).empty());
}
TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateNan_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_TRUE(createIface(IfaceType::NAN).empty());
}
TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateAp_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_TRUE(createIface(IfaceType::AP).empty());
}
TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateStaP2p_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_FALSE(createIface(IfaceType::P2P).empty());
}
TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateAp_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_EQ(createIface(IfaceType::AP), "wlan0");
}
TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateSta_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_TRUE(createIface(IfaceType::STA).empty());
}
TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateP2p_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_TRUE(createIface(IfaceType::STA).empty());
}
TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateNan_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_TRUE(createIface(IfaceType::NAN).empty());
}
@@ -357,46 +362,46 @@
};
TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::P2P).empty());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateNan_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::NAN).empty());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateAp_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_TRUE(createIface(IfaceType::AP).empty());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_FALSE(createIface(IfaceType::P2P).empty());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_FALSE(createIface(IfaceType::NAN).empty());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2PNan_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ 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(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
const auto p2p_iface_name = createIface(IfaceType::P2P);
ASSERT_FALSE(p2p_iface_name.empty());
@@ -408,7 +413,7 @@
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
const auto nan_iface_name = createIface(IfaceType::NAN);
ASSERT_FALSE(nan_iface_name.empty());
@@ -420,50 +425,50 @@
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateAp_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_EQ(createIface(IfaceType::AP), "wlan0");
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateSta_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_TRUE(createIface(IfaceType::STA).empty());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateP2p_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_TRUE(createIface(IfaceType::STA).empty());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateNan_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_TRUE(createIface(IfaceType::NAN).empty());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_TRUE(createRttController());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_TRUE(createRttController());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowApToSta) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ 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(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_TRUE(createRttController());
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_))
.WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS));
@@ -473,7 +478,7 @@
}
TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_EQ(createIface(IfaceType::AP), "wlan0");
EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_))
.WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS));
@@ -496,45 +501,45 @@
};
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateSta_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateP2p_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::P2P).empty());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNan_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::NAN).empty());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateAp_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::AP), "wlan1");
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaSta_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
ASSERT_TRUE(createIface(IfaceType::STA).empty());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
ASSERT_EQ(createIface(IfaceType::AP), "wlan1");
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApSta_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_EQ(createIface(IfaceType::AP), "wlan1");
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateSta_AfterStaApRemove_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ 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);
@@ -549,26 +554,26 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_FALSE(createIface(IfaceType::P2P).empty());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_FALSE(createIface(IfaceType::NAN).empty());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2PNan_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ 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(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
const auto p2p_iface_name = createIface(IfaceType::P2P);
ASSERT_FALSE(p2p_iface_name.empty());
@@ -580,7 +585,7 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_AfterNanRemove_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
const auto nan_iface_name = createIface(IfaceType::NAN);
ASSERT_FALSE(nan_iface_name.empty());
@@ -592,19 +597,19 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApNan_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_FALSE(createIface(IfaceType::AP).empty());
ASSERT_TRUE(createIface(IfaceType::NAN).empty());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApP2p_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_FALSE(createIface(IfaceType::AP).empty());
ASSERT_TRUE(createIface(IfaceType::P2P).empty());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
const auto p2p_iface_name = createIface(IfaceType::P2P);
ASSERT_FALSE(p2p_iface_name.empty());
@@ -616,7 +621,7 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
const auto nan_iface_name = createIface(IfaceType::NAN);
ASSERT_FALSE(nan_iface_name.empty());
@@ -628,7 +633,7 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_EnsureDifferentIfaceNames) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ 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());
@@ -637,25 +642,25 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_TRUE(createRttController());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_TRUE(createRttController());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlow) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_FALSE(createIface(IfaceType::AP).empty());
ASSERT_TRUE(createRttController());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_))
.WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS));
@@ -665,7 +670,7 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP);
ASSERT_EQ(createIface(IfaceType::AP), "wlan1");
EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan1", testing::_))
.WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS));
@@ -675,7 +680,7 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveNanOnStaRemove) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
// Create NAN iface
@@ -711,7 +716,7 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveRttControllerOnStaRemove) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
// Create RTT controller
@@ -735,7 +740,7 @@
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithSharedNanIface) {
property_set("wifi.aware.interface", nullptr);
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
ASSERT_EQ(createIface(IfaceType::NAN), "wlan0");
removeIface(IfaceType::NAN, "wlan0");
@@ -744,7 +749,7 @@
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithDedicatedNanIface) {
property_set("wifi.aware.interface", "aware0");
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ 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));
@@ -764,7 +769,7 @@
};
TEST_F(WifiChipV1_AwareDisabledApIfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_TRUE(createIface(IfaceType::AP).empty());
}
@@ -779,7 +784,7 @@
};
TEST_F(WifiChipV2_AwareDisabledApIfaceCombinationTest, CreateSta_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_TRUE(createIface(IfaceType::AP).empty());
}
@@ -794,7 +799,7 @@
};
TEST_F(WifiChip_MultiIfaceTest, Create3Sta) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_FALSE(createIface(IfaceType::STA).empty());
ASSERT_FALSE(createIface(IfaceType::STA).empty());
@@ -807,7 +812,7 @@
property_set("wifi.interface.2", "");
property_set("wifi.interface", "");
property_set("wifi.concurrent.interface", "");
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
ASSERT_EQ(createIface(IfaceType::STA), "wlan1");
ASSERT_EQ(createIface(IfaceType::STA), "wlan2");
@@ -819,7 +824,7 @@
property_set("wifi.interface.2", "test2");
property_set("wifi.interface", "bad0");
property_set("wifi.concurrent.interface", "bad1");
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
ASSERT_EQ(createIface(IfaceType::STA), "bad0");
ASSERT_EQ(createIface(IfaceType::STA), "bad1");
ASSERT_EQ(createIface(IfaceType::STA), "test2");
@@ -831,14 +836,14 @@
property_set("wifi.interface.2", "");
property_set("wifi.interface", "testA0");
property_set("wifi.concurrent.interface", "testA1");
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ 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) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
+ findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA);
// First AP will be slotted to wlan1.
ASSERT_EQ(createIface(IfaceType::AP), "wlan1");
// First STA will be slotted to wlan0.
diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp
index 4fff770..0e2accf 100644
--- a/wifi/1.6/default/wifi_chip.cpp
+++ b/wifi/1.6/default/wifi_chip.cpp
@@ -728,6 +728,11 @@
&WifiChip::getSupportedRadioCombinationsMatrixInternal, hidl_status_cb);
}
+Return<void> 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_);
@@ -784,9 +789,10 @@
return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0};
}
-std::pair<WifiStatus, std::vector<V1_4::IWifiChip::ChipMode>>
+std::pair<WifiStatus, std::vector<V1_0::IWifiChip::ChipMode>>
WifiChip::getAvailableModesInternal() {
- return {createWifiStatus(WifiStatusCode::SUCCESS), modes_};
+ // Deprecated support -- use getAvailableModes_1_6.
+ return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}};
}
WifiStatus WifiChip::configureChipInternal(
@@ -910,7 +916,7 @@
}
std::pair<WifiStatus, sp<V1_5::IWifiApIface>> WifiChip::createApIfaceInternal() {
- if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::AP)) {
+ if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP)) {
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
std::string ifname = allocateApIfaceName();
@@ -923,7 +929,7 @@
}
std::pair<WifiStatus, sp<V1_5::IWifiApIface>> WifiChip::createBridgedApIfaceInternal() {
- if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::AP)) {
+ if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP_BRIDGED)) {
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
std::vector<std::string> ap_instances = allocateBridgedApInstanceNames();
@@ -1040,7 +1046,7 @@
}
std::pair<WifiStatus, sp<V1_4::IWifiNanIface>> WifiChip::createNanIfaceInternal() {
- if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::NAN)) {
+ if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::NAN)) {
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
bool is_dedicated_iface = true;
@@ -1092,7 +1098,7 @@
}
std::pair<WifiStatus, sp<IWifiP2pIface>> WifiChip::createP2pIfaceInternal() {
- if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::P2P)) {
+ if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::P2P)) {
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
std::string ifname = getPredefinedP2pIfaceName();
@@ -1136,7 +1142,7 @@
}
std::pair<WifiStatus, sp<V1_6::IWifiStaIface>> WifiChip::createStaIfaceInternal() {
- if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::STA)) {
+ if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) {
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
std::string ifname = allocateStaIfaceName();
@@ -1436,7 +1442,8 @@
std::pair<WifiStatus, sp<V1_6::IWifiRttController>> WifiChip::createRttControllerInternal_1_6(
const sp<IWifiIface>& bound_iface) {
- if (sta_ifaces_.size() == 0 && !canCurrentModeSupportIfaceOfType(IfaceType::STA)) {
+ 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), {}};
@@ -1489,6 +1496,11 @@
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_matrix};
}
+std::pair<WifiStatus, std::vector<V1_6::IWifiChip::ChipMode>>
+WifiChip::getAvailableModesInternal_1_6() {
+ return {createWifiStatus(WifiStatusCode::SUCCESS), modes_};
+}
+
WifiStatus WifiChip::handleChipConfiguration(
/* NONNULL */ std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id) {
// If the chip is already configured in a different mode, stop
@@ -1606,7 +1618,8 @@
return createWifiStatusFromLegacyError(legacy_status);
}
-std::vector<V1_4::IWifiChip::ChipIfaceCombination> WifiChip::getCurrentModeIfaceCombinations() {
+std::vector<V1_6::IWifiChip::ChipConcurrencyCombination>
+WifiChip::getCurrentModeConcurrencyCombinations() {
if (!isValidModeId(current_mode_id_)) {
LOG(ERROR) << "Chip not configured in a mode yet";
return {};
@@ -1616,27 +1629,39 @@
return mode.availableCombinations;
}
}
- CHECK(0) << "Expected to find iface combinations for current mode!";
+ CHECK(0) << "Expected to find concurrency combinations for current mode!";
return {};
}
-// Returns a map indexed by IfaceType with the number of ifaces currently
-// created of the corresponding type.
-std::map<IfaceType, size_t> WifiChip::getCurrentIfaceCombination() {
- std::map<IfaceType, size_t> iface_counts;
- iface_counts[IfaceType::AP] = ap_ifaces_.size();
- iface_counts[IfaceType::NAN] = nan_ifaces_.size();
- iface_counts[IfaceType::P2P] = p2p_ifaces_.size();
- iface_counts[IfaceType::STA] = sta_ifaces_.size();
+// Returns a map indexed by IfaceConcurrencyType with the number of ifaces currently
+// created of the corresponding concurrency type.
+std::map<IfaceConcurrencyType, size_t> WifiChip::getCurrentConcurrencyCombination() {
+ std::map<IfaceConcurrencyType, size_t> 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 iface combinations to a more parseable
+// This expands the provided concurrency combinations to a more parseable
// form. Returns a vector of available combinations possible with the number
-// of ifaces of each type in the combination.
-// This method is a port of HalDeviceManager.expandIfaceCombos() from framework.
-std::vector<std::map<IfaceType, size_t>> WifiChip::expandIfaceCombinations(
- const V1_4::IWifiChip::ChipIfaceCombination& combination) {
+// of each concurrency type in the combination.
+// This method is a port of HalDeviceManager.expandConcurrencyCombos() from framework.
+std::vector<std::map<IfaceConcurrencyType, size_t>> 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++) {
@@ -1644,12 +1669,14 @@
}
}
- // Allocate the vector of expanded combos and reset all iface counts to 0
+ // Allocate the vector of expanded combos and reset all concurrency type counts to 0
// in each combo.
- std::vector<std::map<IfaceType, size_t>> expanded_combos;
+ std::vector<std::map<IfaceConcurrencyType, size_t>> expanded_combos;
expanded_combos.resize(num_expanded_combos);
for (auto& expanded_combo : expanded_combos) {
- for (const auto type : {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) {
+ for (const auto type :
+ {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN,
+ IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) {
expanded_combo[type] = 0;
}
}
@@ -1666,12 +1693,15 @@
return expanded_combos;
}
-bool WifiChip::canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces(
- const std::map<IfaceType, size_t>& expanded_combo, IfaceType requested_type) {
- const auto current_combo = getCurrentIfaceCombination();
+bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes(
+ const std::map<IfaceConcurrencyType, size_t>& 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 : {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) {
+ 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++;
@@ -1685,21 +1715,22 @@
}
// This method does the following:
-// a) Enumerate all possible iface combos by expanding the current
-// ChipIfaceCombination.
-// b) Check if the requested iface type can be added to the current mode
-// with the iface combination that is already active.
-bool WifiChip::canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType requested_type) {
+// 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 = getCurrentModeIfaceCombinations();
+ const auto combinations = getCurrentModeConcurrencyCombinations();
for (const auto& combination : combinations) {
- const auto expanded_combos = expandIfaceCombinations(combination);
+ const auto expanded_combos = expandConcurrencyCombinations(combination);
for (const auto& expanded_combo : expanded_combos) {
- if (canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces(expanded_combo,
- requested_type)) {
+ if (canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes(expanded_combo,
+ requested_type)) {
return true;
}
}
@@ -1707,15 +1738,17 @@
return false;
}
-// Note: This does not consider ifaces already active. It only checks if the
-// provided expanded iface combination can support the requested combo.
-bool WifiChip::canExpandedIfaceComboSupportIfaceCombo(
- const std::map<IfaceType, size_t>& expanded_combo,
- const std::map<IfaceType, size_t>& req_combo) {
- // Check if we have space for 1 more iface of |type| in this combo
- for (const auto type : {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) {
+// 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<IfaceConcurrencyType, size_t>& expanded_combo,
+ const std::map<IfaceConcurrencyType, size_t>& 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) {
- // Iface of "type" not in the req_combo.
+ // Concurrency type not in the req_combo.
continue;
}
size_t num_ifaces_needed = req_combo.at(type);
@@ -1727,21 +1760,22 @@
return true;
}
// This method does the following:
-// a) Enumerate all possible iface combos by expanding the current
-// ChipIfaceCombination.
-// b) Check if the requested iface combo can be added to the current mode.
-// Note: This does not consider ifaces already active. It only checks if the
+// 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::canCurrentModeSupportIfaceCombo(const std::map<IfaceType, size_t>& req_combo) {
+bool WifiChip::canCurrentModeSupportConcurrencyCombo(
+ const std::map<IfaceConcurrencyType, size_t>& req_combo) {
if (!isValidModeId(current_mode_id_)) {
LOG(ERROR) << "Chip not configured in a mode yet";
return false;
}
- const auto combinations = getCurrentModeIfaceCombinations();
+ const auto combinations = getCurrentModeConcurrencyCombinations();
for (const auto& combination : combinations) {
- const auto expanded_combos = expandIfaceCombinations(combination);
+ const auto expanded_combos = expandConcurrencyCombinations(combination);
for (const auto& expanded_combo : expanded_combos) {
- if (canExpandedIfaceComboSupportIfaceCombo(expanded_combo, req_combo)) {
+ if (canExpandedConcurrencyComboSupportConcurrencyCombo(expanded_combo, req_combo)) {
return true;
}
}
@@ -1750,14 +1784,14 @@
}
// This method does the following:
-// a) Enumerate all possible iface combos by expanding the current
-// ChipIfaceCombination.
-// b) Check if the requested iface type can be added to the current mode.
-bool WifiChip::canCurrentModeSupportIfaceOfType(IfaceType requested_type) {
- // Check if we can support at least 1 iface of type.
- std::map<IfaceType, size_t> req_iface_combo;
+// 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<IfaceConcurrencyType, size_t> req_iface_combo;
req_iface_combo[requested_type] = 1;
- return canCurrentModeSupportIfaceCombo(req_iface_combo);
+ return canCurrentModeSupportConcurrencyCombo(req_iface_combo);
}
bool WifiChip::isValidModeId(ChipModeId mode_id) {
@@ -1771,17 +1805,17 @@
bool WifiChip::isStaApConcurrencyAllowedInCurrentMode() {
// Check if we can support at least 1 STA & 1 AP concurrently.
- std::map<IfaceType, size_t> req_iface_combo;
- req_iface_combo[IfaceType::AP] = 1;
- req_iface_combo[IfaceType::STA] = 1;
- return canCurrentModeSupportIfaceCombo(req_iface_combo);
+ std::map<IfaceConcurrencyType, size_t> 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<IfaceType, size_t> req_iface_combo;
- req_iface_combo[IfaceType::STA] = 2;
- return canCurrentModeSupportIfaceCombo(req_iface_combo);
+ std::map<IfaceConcurrencyType, size_t> req_iface_combo;
+ req_iface_combo[IfaceConcurrencyType::STA] = 2;
+ return canCurrentModeSupportConcurrencyCombo(req_iface_combo);
}
std::string WifiChip::getFirstActiveWlanIfaceName() {
diff --git a/wifi/1.6/default/wifi_chip.h b/wifi/1.6/default/wifi_chip.h
index 13d62fb..f952a68 100644
--- a/wifi/1.6/default/wifi_chip.h
+++ b/wifi/1.6/default/wifi_chip.h
@@ -17,6 +17,11 @@
#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 <list>
#include <map>
#include <mutex>
@@ -162,6 +167,7 @@
getUsableChannels_1_6_cb _hidl_cb) override;
Return<void> getSupportedRadioCombinationsMatrix(
getSupportedRadioCombinationsMatrix_cb hidl_status_cb) override;
+ Return<void> getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) override;
private:
void invalidateAndRemoveAllIfaces();
@@ -175,7 +181,7 @@
WifiStatus registerEventCallbackInternal(
const sp<V1_0::IWifiChipEventCallback>& event_callback);
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
- std::pair<WifiStatus, std::vector<ChipMode>> getAvailableModesInternal();
+ std::pair<WifiStatus, std::vector<V1_0::IWifiChip::ChipMode>> getAvailableModesInternal();
WifiStatus configureChipInternal(std::unique_lock<std::recursive_mutex>* lock,
ChipModeId mode_id);
std::pair<WifiStatus, uint32_t> getModeInternal();
@@ -239,17 +245,21 @@
ChipModeId mode_id);
WifiStatus registerDebugRingBufferCallback();
WifiStatus registerRadioModeChangeCallback();
- std::vector<V1_4::IWifiChip::ChipIfaceCombination> getCurrentModeIfaceCombinations();
- std::map<IfaceType, size_t> getCurrentIfaceCombination();
- std::vector<std::map<IfaceType, size_t>> expandIfaceCombinations(
- const V1_4::IWifiChip::ChipIfaceCombination& combination);
- bool canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces(
- const std::map<IfaceType, size_t>& expanded_combo, IfaceType requested_type);
- bool canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType requested_type);
- bool canExpandedIfaceComboSupportIfaceCombo(const std::map<IfaceType, size_t>& expanded_combo,
- const std::map<IfaceType, size_t>& req_combo);
- bool canCurrentModeSupportIfaceCombo(const std::map<IfaceType, size_t>& req_combo);
- bool canCurrentModeSupportIfaceOfType(IfaceType requested_type);
+ std::vector<V1_6::IWifiChip::ChipConcurrencyCombination>
+ getCurrentModeConcurrencyCombinations();
+ std::map<IfaceConcurrencyType, size_t> getCurrentConcurrencyCombination();
+ std::vector<std::map<IfaceConcurrencyType, size_t>> expandConcurrencyCombinations(
+ const V1_6::IWifiChip::ChipConcurrencyCombination& combination);
+ bool canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes(
+ const std::map<IfaceConcurrencyType, size_t>& expanded_combo,
+ IfaceConcurrencyType requested_type);
+ bool canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType requested_type);
+ bool canExpandedConcurrencyComboSupportConcurrencyCombo(
+ const std::map<IfaceConcurrencyType, size_t>& expanded_combo,
+ const std::map<IfaceConcurrencyType, size_t>& req_combo);
+ bool canCurrentModeSupportConcurrencyCombo(
+ const std::map<IfaceConcurrencyType, size_t>& req_combo);
+ bool canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type);
bool isValidModeId(ChipModeId mode_id);
bool isStaApConcurrencyAllowedInCurrentMode();
bool isDualStaConcurrencyAllowedInCurrentMode();
@@ -270,6 +280,7 @@
std::pair<WifiStatus, std::vector<V1_6::WifiUsableChannel>> getUsableChannelsInternal_1_6(
WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask);
std::pair<WifiStatus, WifiRadioCombinationMatrix> getSupportedRadioCombinationsMatrixInternal();
+ std::pair<WifiStatus, std::vector<V1_6::IWifiChip::ChipMode>> getAvailableModesInternal_1_6();
ChipId chip_id_;
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
@@ -285,7 +296,7 @@
// Members pertaining to chip configuration.
uint32_t current_mode_id_;
std::mutex lock_t;
- std::vector<V1_4::IWifiChip::ChipMode> modes_;
+ std::vector<V1_6::IWifiChip::ChipMode> 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.
diff --git a/wifi/1.6/default/wifi_feature_flags.cpp b/wifi/1.6/default/wifi_feature_flags.cpp
index 71319e1..e80a3cd 100644
--- a/wifi/1.6/default/wifi_feature_flags.cpp
+++ b/wifi/1.6/default/wifi_feature_flags.cpp
@@ -29,8 +29,8 @@
namespace feature_flags {
using V1_0::ChipModeId;
-using V1_0::IfaceType;
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
@@ -42,9 +42,9 @@
* WIFI_HAL_INTERFACE_COMBINATIONS := {{{STA, AP}, 1}, {{P2P, NAN}, 1}},
* WIFI_HAL_INTERFACE_COMBINATIONS += {{{STA}, 1}, {{AP}, 2}}
* What means:
- * Interface combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface
+ * Interface concurrency combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface
* operations.
- * Interface combination 2: 1 STA and 2 AP 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:
@@ -53,20 +53,20 @@
* - 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 interface combinations:
- * Interface Combination 1: Will support 1 STA and 1 P2P or NAN (optional)
+ * two concurrency combinations:
+ * Interface Concurrency Combination 1: Will support 1 STA and 1 P2P or NAN (optional)
* concurrent iface operations.
- * Interface Combination 2: Will support 1 STA and 1 AP concurrent
+ * 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 interface combination each:
+ * 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 iface combination will be modified to support either
+ * If Aware is enabled, the concurrency combination will be modified to support either
* P2P or NAN in place of just P2P.
*/
// clang-format off
@@ -117,79 +117,87 @@
* The main point here is to simplify the syntax required by
* WIFI_HAL_INTERFACE_COMBINATIONS.
*/
-struct ChipIfaceCombination : public hidl_vec<IWifiChip::ChipIfaceCombinationLimit> {
- ChipIfaceCombination(const std::initializer_list<IWifiChip::ChipIfaceCombinationLimit> list)
+struct ChipConcurrencyCombination
+ : public hidl_vec<V1_6::IWifiChip::ChipConcurrencyCombinationLimit> {
+ ChipConcurrencyCombination(
+ const std::initializer_list<V1_6::IWifiChip::ChipConcurrencyCombinationLimit> list)
: hidl_vec(list) {}
- operator IWifiChip::ChipIfaceCombination() const { return {*this}; }
+ operator V1_6::IWifiChip::ChipConcurrencyCombination() const { return {*this}; }
- static hidl_vec<IWifiChip::ChipIfaceCombination> make_vec(
- const std::initializer_list<ChipIfaceCombination> list) {
- return hidl_vec<IWifiChip::ChipIfaceCombination>( //
+ static hidl_vec<V1_6::IWifiChip::ChipConcurrencyCombination> make_vec(
+ const std::initializer_list<ChipConcurrencyCombination> list) {
+ return hidl_vec<V1_6::IWifiChip::ChipConcurrencyCombination>( //
std::begin(list), std::end(list));
}
};
-#define STA IfaceType::STA
-#define AP IfaceType::AP
-#define P2P IfaceType::P2P
-#define NAN IfaceType::NAN
-static const std::vector<IWifiChip::ChipMode> kChipModesPrimary{
- {kMainModeId, ChipIfaceCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS})},
+#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<V1_6::IWifiChip::ChipMode> kChipModesPrimary{
+ {kMainModeId, ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS})},
#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_AP
{chip_mode_ids::kV1Ap,
- ChipIfaceCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_AP})},
+ ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_AP})},
#endif
};
-static const std::vector<IWifiChip::ChipMode> kChipModesSecondary{
+static const std::vector<V1_6::IWifiChip::ChipMode> kChipModesSecondary{
#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP
{chip_mode_ids::kV3,
- ChipIfaceCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})},
+ 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 interface combinations that can be enabled at runtime via
+// 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<std::pair<std::string, std::vector<IWifiChip::ChipMode>>> kDebugChipModes{
- // Legacy combination - No STA/AP concurrencies.
- // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN))
- {"No STA/AP Concurrency",
- {{kMainModeId,
- ChipIfaceCombination::make_vec({{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
+static const std::vector<std::pair<std::string, std::vector<V1_6::IWifiChip::ChipMode>>>
+ 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, ChipIfaceCombination::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,
+ 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, ChipIfaceCombination::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,
+ 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, ChipIfaceCombination::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,
+ 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, ChipIfaceCombination::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,
+ 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,
- ChipIfaceCombination::make_vec({{{{STA}, 1}, {{P2P, NAN, AP}, 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
@@ -206,13 +214,13 @@
WifiFeatureFlags::WifiFeatureFlags() {}
-std::vector<IWifiChip::ChipMode> WifiFeatureFlags::getChipModesForPrimary() {
+std::vector<V1_6::IWifiChip::ChipMode> WifiFeatureFlags::getChipModesForPrimary() {
std::array<char, PROPERTY_VALUE_MAX> buffer;
auto res = property_get(kDebugPresetInterfaceCombinationIdxProperty, buffer.data(), nullptr);
- // Debug propety not set, use the device preset interface combination.
+ // Debug property not set, use the device preset concurrency combination.
if (res <= 0) return kChipModesPrimary;
- // Debug propety set, use one of the debug preset interface combination.
+ // 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: "
@@ -220,14 +228,14 @@
return kChipModesPrimary;
}
std::string name;
- std::vector<IWifiChip::ChipMode> chip_modes;
+ std::vector<V1_6::IWifiChip::ChipMode> 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<IWifiChip::ChipMode> WifiFeatureFlags::getChipModes(bool is_primary) {
+std::vector<V1_6::IWifiChip::ChipMode> WifiFeatureFlags::getChipModes(bool is_primary) {
return (is_primary) ? getChipModesForPrimary() : kChipModesSecondary;
}
diff --git a/wifi/1.6/default/wifi_feature_flags.h b/wifi/1.6/default/wifi_feature_flags.h
index d5844d9..1635341 100644
--- a/wifi/1.6/default/wifi_feature_flags.h
+++ b/wifi/1.6/default/wifi_feature_flags.h
@@ -17,7 +17,7 @@
#ifndef WIFI_FEATURE_FLAGS_H_
#define WIFI_FEATURE_FLAGS_H_
-#include <android/hardware/wifi/1.2/IWifiChip.h>
+#include <android/hardware/wifi/1.6/IWifiChip.h>
namespace android {
namespace hardware {
@@ -42,10 +42,10 @@
WifiFeatureFlags();
virtual ~WifiFeatureFlags() = default;
- virtual std::vector<V1_0::IWifiChip::ChipMode> getChipModes(bool is_primary);
+ virtual std::vector<V1_6::IWifiChip::ChipMode> getChipModes(bool is_primary);
private:
- std::vector<V1_0::IWifiChip::ChipMode> getChipModesForPrimary();
+ std::vector<V1_6::IWifiChip::ChipMode> getChipModesForPrimary();
};
} // namespace feature_flags
diff --git a/wifi/1.6/types.hal b/wifi/1.6/types.hal
index 80fdbd1..aed37fa 100644
--- a/wifi/1.6/types.hal
+++ b/wifi/1.6/types.hal
@@ -1312,3 +1312,29 @@
*/
vec<WifiRadioCombination> radioCombinations;
};
+
+/**
+ * List of interface concurrency types, used in reporting device concurrency capabilities.
+ */
+enum IfaceConcurrencyType : uint32_t {
+ /**
+ * Concurrency type for station mode.
+ */
+ STA,
+ /**
+ * Concurrency type of single-port AP mode.
+ */
+ AP,
+ /**
+ * Concurrency type of two-port bridged AP mode.
+ */
+ AP_BRIDGED,
+ /**
+ * Concurrency type of peer-to-peer mode.
+ */
+ P2P,
+ /**
+ * Concurrency type of neighborhood area network mode.
+ */
+ NAN,
+};
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl
index bdbaadd..ca20f37 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ApInfo.aidl
@@ -37,7 +37,7 @@
String ifaceName;
String apIfaceInstance;
int freqMhz;
- android.hardware.wifi.hostapd.Bandwidth bandwidth;
+ android.hardware.wifi.hostapd.ChannelBandwidth channelBandwidth;
android.hardware.wifi.hostapd.Generation generation;
byte[] apIfaceInstanceMacAddress;
}
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Bandwidth.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
similarity index 86%
rename from wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Bandwidth.aidl
rename to wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
index 4d78640..6c1fd22 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Bandwidth.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
@@ -33,17 +33,18 @@
package android.hardware.wifi.hostapd;
@Backing(type="int") @VintfStability
-enum Bandwidth {
+enum ChannelBandwidth {
BANDWIDTH_INVALID = 0,
- BANDWIDTH_20_NOHT = 1,
- BANDWIDTH_20 = 2,
- BANDWIDTH_40 = 3,
- BANDWIDTH_80 = 4,
- BANDWIDTH_80P80 = 5,
- BANDWIDTH_160 = 6,
- BANDWIDTH_320 = 7,
- BANDWIDTH_2160 = 8,
- BANDWIDTH_4320 = 9,
- BANDWIDTH_6480 = 10,
- BANDWIDTH_8640 = 11,
+ BANDWIDTH_AUTO = 1,
+ BANDWIDTH_20_NOHT = 2,
+ BANDWIDTH_20 = 3,
+ BANDWIDTH_40 = 4,
+ BANDWIDTH_80 = 5,
+ BANDWIDTH_80P80 = 6,
+ BANDWIDTH_160 = 7,
+ BANDWIDTH_320 = 8,
+ BANDWIDTH_2160 = 9,
+ BANDWIDTH_4320 = 10,
+ BANDWIDTH_6480 = 11,
+ BANDWIDTH_8640 = 12,
}
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
index ae3dccb..a7b20fa 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
@@ -39,5 +39,6 @@
WPA2 = 2,
WPA3_SAE_TRANSITION = 3,
WPA3_SAE = 4,
- OWE_TRANSITION = 5,
+ WPA3_OWE_TRANSITION = 5,
+ WPA3_OWE = 6,
}
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HwModeParams.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HwModeParams.aidl
index 8d8d7bb..d732bcb 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HwModeParams.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HwModeParams.aidl
@@ -44,4 +44,5 @@
boolean enableHeTargetWakeTime;
boolean enableEdmg;
boolean enable80211BE;
+ android.hardware.wifi.hostapd.ChannelBandwidth maximumChannelBandwidth;
}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl
index bf506b2..a6fe63b 100644
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ApInfo.aidl
@@ -16,7 +16,7 @@
package android.hardware.wifi.hostapd;
-import android.hardware.wifi.hostapd.Bandwidth;
+import android.hardware.wifi.hostapd.ChannelBandwidth;
import android.hardware.wifi.hostapd.Generation;
/**
@@ -44,9 +44,9 @@
int freqMhz;
/**
- * The operational bandwidth of the AP.
+ * The operational channel bandwidth of the AP.
*/
- Bandwidth bandwidth;
+ ChannelBandwidth channelBandwidth;
/**
* The operational mode of the AP (e.g. 11ac, 11ax).
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl
deleted file mode 100644
index e605153..0000000
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl
+++ /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 android.hardware.wifi.hostapd;
-
-/**
- * The channel bandwidth of the AP.
- */
-@VintfStability
-@Backing(type="int")
-enum Bandwidth {
- BANDWIDTH_INVALID = 0,
- BANDWIDTH_20_NOHT = 1,
- BANDWIDTH_20 = 2,
- BANDWIDTH_40 = 3,
- BANDWIDTH_80 = 4,
- BANDWIDTH_80P80 = 5,
- BANDWIDTH_160 = 6,
- BANDWIDTH_320 = 7,
- BANDWIDTH_2160 = 8,
- BANDWIDTH_4320 = 9,
- BANDWIDTH_6480 = 10,
- BANDWIDTH_8640 = 11,
-}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ChannelBandwidth.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ChannelBandwidth.aidl
new file mode 100644
index 0000000..8ea3952
--- /dev/null
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/ChannelBandwidth.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.
+ */
+
+package android.hardware.wifi.hostapd;
+
+/**
+ * The channel bandwidth of the AP.
+ */
+@VintfStability
+@Backing(type="int")
+enum ChannelBandwidth {
+ /**
+ * Invalid bandwidth value for AP
+ */
+ BANDWIDTH_INVALID = 0,
+ /**
+ * Channel bandwidth is auto-selected by the chip
+ */
+ BANDWIDTH_AUTO = 1,
+ /**
+ * AP channel bandwidth is 20 MHz but not HT
+ */
+ BANDWIDTH_20_NOHT = 2,
+ /**
+ * AP channel bandwidth is 20 MHz
+ */
+ BANDWIDTH_20 = 3,
+ /**
+ * AP channel bandwidth is 40 MHz
+ */
+ BANDWIDTH_40 = 4,
+ /**
+ * AP channel bandwidth is 80 MHz
+ */
+ BANDWIDTH_80 = 5,
+ /**
+ * AP channel bandwidth is 80+80 MHz
+ */
+ BANDWIDTH_80P80 = 6,
+ /**
+ * AP channel bandwidth is 160 MHz
+ */
+ BANDWIDTH_160 = 7,
+ /**
+ * AP channel bandwidth is 320 MHz
+ */
+ BANDWIDTH_320 = 8,
+ /**
+ * AP channel bandwidth is 2160 MHz
+ */
+ BANDWIDTH_2160 = 9,
+ /**
+ * AP channel bandwidth is 4320 MHz
+ */
+ BANDWIDTH_4320 = 10,
+ /**
+ * AP channel bandwidth is 6480 MHz
+ */
+ BANDWIDTH_6480 = 11,
+ /**
+ * AP channel bandwidth is 8640 MHz
+ */
+ BANDWIDTH_8640 = 12,
+}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/EncryptionType.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/EncryptionType.aidl
index a8f3252..eb06b4a 100644
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/EncryptionType.aidl
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/EncryptionType.aidl
@@ -29,5 +29,6 @@
WPA2,
WPA3_SAE_TRANSITION,
WPA3_SAE,
- OWE_TRANSITION,
+ WPA3_OWE_TRANSITION,
+ WPA3_OWE,
}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/HwModeParams.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/HwModeParams.aidl
index e66a24a..320db9c 100644
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/HwModeParams.aidl
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/HwModeParams.aidl
@@ -16,6 +16,8 @@
package android.hardware.wifi.hostapd;
+import android.hardware.wifi.hostapd.ChannelBandwidth;
+
/**
* Parameters to control the HW mode for the interface.
*/
@@ -74,4 +76,9 @@
* used with Extreme High Throughput.
*/
boolean enable80211BE;
+ /**
+ * Limit on maximum channel bandwidth for the softAp.
+ * For automatic selection with no limit use BANDWIDTH_AUTO
+ */
+ ChannelBandwidth maximumChannelBandwidth;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppConnectionKeys.aidl
similarity index 89%
copy from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppConnectionKeys.aidl
index d2b48d2..559d1c9 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppConnectionKeys.aidl
@@ -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.
@@ -31,9 +31,10 @@
// with such a backward incompatible 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;
+package android.hardware.wifi.supplicant;
@VintfStability
-parcelable DecryptResult {
- int bytesWritten;
- String detailedError;
+parcelable DppConnectionKeys {
+ byte[] connector;
+ byte[] cSign;
+ byte[] netAccessKey;
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantCallback.aidl
index 72ab3b9..7281053 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantCallback.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantCallback.aidl
@@ -36,5 +36,4 @@
interface ISupplicantCallback {
oneway void onInterfaceCreated(in String ifaceName);
oneway void onInterfaceRemoved(in String ifaceName);
- oneway void onTerminating();
}
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 f709aef..d7eff76 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
@@ -95,4 +95,5 @@
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);
}
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 826d916..8d9f498 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
@@ -51,4 +51,5 @@
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);
}
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 5c0aacd..9293bfd 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
@@ -44,7 +44,9 @@
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();
@@ -82,7 +84,7 @@
void setWpsModelName(in String modelName);
void setWpsModelNumber(in String modelNumber);
void setWpsSerialNumber(in String serialNumber);
- void 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);
+ 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();
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 c17c624..8d11d41 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
@@ -43,7 +43,7 @@
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);
- oneway void onDppSuccessConfigReceived(in byte[] ssid, in String password, in byte[] psk, in android.hardware.wifi.supplicant.DppAkm securityAkm);
+ 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 int errorCode);
oneway void onExtRadioWorkStart(in int id);
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 bdc5f34..0b3cb81 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
@@ -87,6 +87,7 @@
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);
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl
similarity index 90%
rename from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
rename to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl
index d2b48d2..5e2c47b 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl
@@ -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.
@@ -31,9 +31,9 @@
// with such a backward incompatible 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;
+package android.hardware.wifi.supplicant;
@VintfStability
-parcelable DecryptResult {
- int bytesWritten;
- String detailedError;
+parcelable MloLink {
+ byte linkId;
+ byte[] staLinkMacAddress;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl
similarity index 89%
copy from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl
index d2b48d2..14fcb91 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptResult.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl
@@ -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.
@@ -31,9 +31,8 @@
// with such a backward incompatible 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;
+package android.hardware.wifi.supplicant;
@VintfStability
-parcelable DecryptResult {
- int bytesWritten;
- String detailedError;
+parcelable MloLinksInfo {
+ android.hardware.wifi.supplicant.MloLink[] links;
}
diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl
similarity index 75%
copy from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl
copy to wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl
index b6ec34d..6e1b957 100644
--- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/BufferType.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl
@@ -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.
@@ -31,9 +31,20 @@
// with such a backward incompatible 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;
+package android.hardware.wifi.supplicant;
@Backing(type="int") @VintfStability
-enum BufferType {
- SHARED_MEMORY = 0,
- NATIVE_HANDLE = 1,
+enum P2pFrameTypeMask {
+ P2P_FRAME_PROBE_REQ_P2P = 1,
+ P2P_FRAME_PROBE_RESP_P2P = 2,
+ P2P_FRAME_PROBE_RESP_P2P_GO = 4,
+ P2P_FRAME_BEACON_P2P_GO = 8,
+ P2P_FRAME_P2P_PD_REQ = 16,
+ P2P_FRAME_P2P_PD_RESP = 32,
+ P2P_FRAME_P2P_GO_NEG_REQ = 64,
+ P2P_FRAME_P2P_GO_NEG_RESP = 128,
+ P2P_FRAME_P2P_GO_NEG_CONF = 256,
+ P2P_FRAME_P2P_INV_REQ = 512,
+ P2P_FRAME_P2P_INV_RESP = 1024,
+ P2P_FRAME_P2P_ASSOC_REQ = 2048,
+ P2P_FRAME_P2P_ASSOC_RESP = 4096,
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppConnectionKeys.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppConnectionKeys.aidl
new file mode 100644
index 0000000..056756b
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppConnectionKeys.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.supplicant;
+
+/**
+ * connection keys that are used for DPP network connection.
+ */
+@VintfStability
+parcelable DppConnectionKeys {
+ /**
+ * DPP Connector (signedConnector)
+ */
+ byte[] connector;
+ /**
+ * C-sign-key (Configurator public key)
+ */
+ byte[] cSign;
+ /**
+ * DPP net access key (own private key)
+ */
+ byte[] netAccessKey;
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantCallback.aidl
index 6f15900..8e59ec9 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantCallback.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantCallback.aidl
@@ -24,23 +24,18 @@
* |ISupplicant.registerCallback| method.
*/
@VintfStability
-interface ISupplicantCallback {
+oneway interface ISupplicantCallback {
/**
* Used to indicate that a new interface has been created.
*
* @param ifaceName Name of the network interface, e.g., wlan0
*/
- oneway void onInterfaceCreated(in String ifaceName);
+ void onInterfaceCreated(in String ifaceName);
/**
* Used to indicate that an interface has been removed.
*
* @param ifaceName Name of the network interface, e.g., wlan0
*/
- oneway void onInterfaceRemoved(in String ifaceName);
-
- /**
- * Used to indicate that the supplicant daemon is terminating.
- */
- oneway void onTerminating();
+ void onInterfaceRemoved(in String ifaceName);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
index 7588c74..9021bf5 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
@@ -21,6 +21,7 @@
import android.hardware.wifi.supplicant.ISupplicantP2pNetwork;
import android.hardware.wifi.supplicant.IfaceType;
import android.hardware.wifi.supplicant.MiracastMode;
+import android.hardware.wifi.supplicant.P2pFrameTypeMask;
import android.hardware.wifi.supplicant.P2pGroupCapabilityMask;
import android.hardware.wifi.supplicant.WpsConfigMethods;
import android.hardware.wifi.supplicant.WpsProvisionMethod;
@@ -810,4 +811,20 @@
* |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
*/
void findOnSpecificFrequency(in int freqInHz, in int timeoutInSec);
+
+ /**
+ * Set vendor-specific information elements to P2P frames.
+ *
+ * @param frameTypeMask The bit mask of P2P frame type represented by
+ * P2pFrameTypeMask.
+ * @param vendorElemBytes Vendor-specific information element bytes. The format of an
+ * information element is EID (1 byte) + Length (1 Byte) + Payload which is
+ * defined in Section 9.4.4 TLV encodings of 802.11-2016 IEEE Standard for
+ * Information technology. The length indicates the size of the payload.
+ * Multiple information elements may be appended within the byte array.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ void setVendorElements(in P2pFrameTypeMask frameTypeMask, in byte[] vendorElemBytes);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl
index 2b58cc2..7c8c1f2 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl
@@ -31,7 +31,7 @@
* corresponding |ISupplicantP2pIface.registerCallback| method.
*/
@VintfStability
-interface ISupplicantP2pIfaceCallback {
+oneway interface ISupplicantP2pIfaceCallback {
/**
* Used to indicate that a P2P device has been found.
*
@@ -50,7 +50,7 @@
* @param wfdDeviceInfo WFD device info as described in section 5.1.2 of WFD
* technical specification v1.0.0.
*/
- oneway void onDeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress,
+ void onDeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress,
in byte[] primaryDeviceType, in String deviceName, in WpsConfigMethods configMethods,
in byte deviceCapabilities, in P2pGroupCapabilityMask groupCapabilities,
in byte[] wfdDeviceInfo);
@@ -60,19 +60,19 @@
*
* @param p2pDeviceAddress P2P device address.
*/
- oneway void onDeviceLost(in byte[] p2pDeviceAddress);
+ void onDeviceLost(in byte[] p2pDeviceAddress);
/**
* Used to indicate the termination of P2P find operation.
*/
- oneway void onFindStopped();
+ void onFindStopped();
/**
* Used to indicate the completion of a P2P Group Owner negotiation request.
*
* @param status Status of the GO negotiation.
*/
- oneway void onGoNegotiationCompleted(in P2pStatusCode status);
+ void onGoNegotiationCompleted(in P2pStatusCode status);
/**
* Used to indicate the reception of a P2P Group Owner negotiation request.
@@ -81,19 +81,19 @@
* negotiation request.
* @param passwordId Type of password.
*/
- oneway void onGoNegotiationRequest(in byte[] srcAddress, in WpsDevPasswordId passwordId);
+ void onGoNegotiationRequest(in byte[] srcAddress, in WpsDevPasswordId passwordId);
/**
* Used to indicate a failure to form a P2P group.
*
* @param failureReason Failure reason string for debug purposes.
*/
- oneway void onGroupFormationFailure(in String failureReason);
+ void onGroupFormationFailure(in String failureReason);
/**
* Used to indicate a successful formation of a P2P group.
*/
- oneway void onGroupFormationSuccess();
+ void onGroupFormationSuccess();
/**
* Used to indicate the removal of a P2P group.
@@ -101,7 +101,7 @@
* @param groupIfName Interface name of the group. (For ex: p2p-p2p0-1)
* @param isGroupOwner Whether this device is owner of the group.
*/
- oneway void onGroupRemoved(in String groupIfname, in boolean isGroupOwner);
+ void onGroupRemoved(in String groupIfname, in boolean isGroupOwner);
/**
* Used to indicate the start of a P2P group.
@@ -115,7 +115,7 @@
* @param goDeviceAddress MAC Address of the owner of this group.
* @param isPersistent Whether this group is persisted or not.
*/
- oneway void onGroupStarted(in String groupIfname, in boolean isGroupOwner, in byte[] ssid,
+ 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);
@@ -128,8 +128,8 @@
* @param persistentNetworkId Persistent network Id of the group.
* @param operatingFrequency Frequency on which the invitation was received.
*/
- oneway void onInvitationReceived(in byte[] srcAddress, in byte[] goDeviceAddress,
- in byte[] bssid, in int persistentNetworkId, in int operatingFrequency);
+ void onInvitationReceived(in byte[] srcAddress, in byte[] goDeviceAddress, in byte[] bssid,
+ in int persistentNetworkId, in int operatingFrequency);
/**
* Used to indicate the result of the P2P invitation request.
@@ -137,7 +137,7 @@
* @param bssid Bssid of the group.
* @param status Status of the invitation.
*/
- oneway void onInvitationResult(in byte[] bssid, in P2pStatusCode status);
+ void onInvitationResult(in byte[] bssid, in P2pStatusCode status);
/**
* Used to indicate the completion of a P2P provision discovery request.
@@ -148,7 +148,7 @@
* @param configMethods Mask of WPS configuration methods supported.
* @param generatedPin 8 digit pin generated.
*/
- oneway void onProvisionDiscoveryCompleted(in byte[] p2pDeviceAddress, in boolean isRequest,
+ void onProvisionDiscoveryCompleted(in byte[] p2pDeviceAddress, in boolean isRequest,
in P2pProvDiscStatusCode status, in WpsConfigMethods configMethods,
in String generatedPin);
@@ -174,7 +174,7 @@
* @param wfdR2DeviceInfo WFD R2 device info as described in section 5.1.12 of WFD
* technical specification v2.1.
*/
- oneway void onR2DeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress,
+ void onR2DeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress,
in byte[] primaryDeviceType, in String deviceName, in WpsConfigMethods configMethods,
in byte deviceCapabilities, in P2pGroupCapabilityMask groupCapabilities,
in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo);
@@ -187,8 +187,7 @@
* Wifi P2P Technical specification v1.2.
* @parm tlvs Refer to section 3.1.3.1 of Wifi P2P Technical specification v1.2.
*/
- oneway void onServiceDiscoveryResponse(
- in byte[] srcAddress, in char updateIndicator, in byte[] tlvs);
+ void onServiceDiscoveryResponse(in byte[] srcAddress, in char updateIndicator, in byte[] tlvs);
/**
* Used to indicate when a STA device is connected to this device.
@@ -196,7 +195,7 @@
* @param srcAddress MAC address of the device that was authorized.
* @param p2pDeviceAddress P2P device address.
*/
- oneway void onStaAuthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress);
+ void onStaAuthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress);
/**
* Used to indicate when a STA device is disconnected from this device.
@@ -204,7 +203,7 @@
* @param srcAddress MAC address of the device that was deauthorized.
* @param p2pDeviceAddress P2P device address.
*/
- oneway void onStaDeauthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress);
+ void onStaDeauthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress);
/**
* Used to indicate that operating frequency has changed for this P2P group interface.
@@ -212,5 +211,36 @@
* @param groupIfName Interface name of the group. (For ex: p2p-p2p0-1)
* @param frequency New operating frequency in MHz.
*/
- oneway void onGroupFrequencyChanged(in String groupIfname, in int frequency);
+ void onGroupFrequencyChanged(in String groupIfname, in int frequency);
+
+ /**
+ * Used to indicate that a P2P device has been found.
+ *
+ * @param srcAddress MAC address of the device found. This must either
+ * be the P2P device address for a peer which is not in a group,
+ * or the P2P interface address for a peer which is a Group Owner.
+ * @param p2pDeviceAddress P2P device address.
+ * @param primaryDeviceType Type of device. Refer to section B.1 of Wifi P2P
+ * Technical specification v1.2.
+ * @param deviceName Name of the device.
+ * @param configMethods Mask of WPS configuration methods supported by the
+ * device.
+ * @param deviceCapabilities Refer to section 4.1.4 of Wifi P2P Technical
+ * specification v1.2.
+ * @param groupCapabilites Refer to section 4.1.4 of Wifi P2P Technical
+ * specification v1.2.
+ * @param wfdDeviceInfo WFD device info as described in section 5.1.2 of WFD
+ * technical specification v1.0.0.
+ * @param wfdR2DeviceInfo WFD R2 device info as described in section 5.1.12 of WFD
+ * technical specification v2.1.
+ * @param vendorElemBytes Vendor-specific information element bytes. The format of an
+ * information element is EID (1 byte) + Length (1 Byte) + Payload which is
+ * defined in Section 9.4.4 TLV encodings of 802.11-2016 IEEE Standard for
+ * Information technology. The length indicates the size of the payload.
+ * Multiple information elements may be appended within the byte array.
+ */
+ void onDeviceFoundWithVendorElements(in byte[] srcAddress, in byte[] p2pDeviceAddress,
+ in byte[] primaryDeviceType, in String deviceName, in WpsConfigMethods configMethods,
+ in byte deviceCapabilities, in P2pGroupCapabilityMask groupCapabilities,
+ in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo, in byte[] vendorElemBytes);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
index a48a991..8ab0c82 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
@@ -28,6 +28,7 @@
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.QosPolicyStatus;
import android.hardware.wifi.supplicant.RxFilterType;
import android.hardware.wifi.supplicant.WpaDriverCapabilitiesMask;
@@ -179,6 +180,24 @@
in byte[] macAddress, in String deviceInfo, in DppCurve curve);
/**
+ * To Onboard / Configure self with DPP credentials.
+ *
+ * This is used to generate DppConnectionKeys for self. Thus a configurator
+ * can use the credentials to connect to an AP which it has configured for
+ * DPP AKM. This should be called before initiating first DPP connection
+ * on Configurator side. This API generates onDppSuccessConfigReceived()
+ * callback event asynchronously with DppConnectionKeys.
+ *
+ * @param ssid Network SSID configured profile
+ * @param privEcKey Private EC keys for this profile which was used to
+ * configure other enrollee in network.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|
+ * |SupplicantStatusCode.FAILURE_UNSUPPORTED|
+ */
+ void generateSelfDppConfiguration(in String ssid, in byte[] privEcKey);
+
+ /**
* Get Connection capabilities
*
* @return Connection capabilities.
@@ -188,6 +207,15 @@
ConnectionCapabilities getConnectionCapabilities();
/**
+ * Get Connection MLO links Info
+ *
+ * @return Connection MLO Links Info.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|
+ */
+ MloLinksInfo getConnectionMloLinksInfo();
+
+ /**
* Get Key management capabilities of the device
*
* @return Bitmap of key management mask.
@@ -424,12 +452,12 @@
* This allows other radio works to be performed. If this method is not
* invoked (e.g., due to the external program terminating), supplicant
* must time out the radio work item on the iface and send
- * |ISupplicantCallback.onExtRadioWorkTimeout| event to indicate
+ * |ISupplicantStaIfaceCallback.onExtRadioWorkTimeout| event to indicate
* that this has happened.
*
* This method may also be used to cancel items that have been scheduled
* via |addExtRadioWork|, but have not yet been started (notified via
- * |ISupplicantCallback.onExtRadioWorkStart|).
+ * |ISupplicantStaIfaceCallback.onExtRadioWorkStart|).
*
* @param id Identifier generated for the radio work addition
* (using |addExtRadioWork|).
@@ -620,20 +648,27 @@
*
* @param peerBootstrapId Peer device's URI ID.
* @param ownBootstrapId Local device's URI ID (0 for none, optional).
- * @param ssid Network SSID to send to peer (SAE/PSK mode).
+ * @param ssid Network SSID to send to peer (SAE/PSK/DPP mode).
* @param password Network password to send to peer (SAE/PSK mode).
* @param psk Network PSK to send to peer (PSK mode only). Either password or psk should be set.
* @param netRole Role to configure the peer, |DppNetRole.DPP_NET_ROLE_STA| or
* |DppNetRole.DPP_NET_ROLE_AP|.
* @param securityAkm Security AKM to use (See DppAkm).
+ * @param privEcKey Private EC keys for this profile which was used to
+ * configure other enrollee in network. This param is valid only for DPP AKM.
+ * This param is set to Null by configurator to indicate first DPP-AKM based
+ * configuration to an Enrollee. non-Null value indicates configurator had
+ * previously configured an enrollee.
+ * @return Return the Private EC key when securityAkm is DPP and privEcKey was Null.
+ * Otherwise return Null.
* @throws ServiceSpecificException with one of the following values:
* |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
- void startDppConfiguratorInitiator(in int peerBootstrapId, in int ownBootstrapId,
+ byte[] startDppConfiguratorInitiator(in int peerBootstrapId, in int ownBootstrapId,
in String ssid, in String password, in String psk, in DppNetRole netRole,
- in DppAkm securityAkm);
+ in DppAkm securityAkm, in byte[] privEcKey);
/**
* Start DPP in Enrollee-Initiator mode.
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
index ca63f5c..ade68f0 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
@@ -21,6 +21,7 @@
import android.hardware.wifi.supplicant.BssTmData;
import android.hardware.wifi.supplicant.BssidChangeReason;
import android.hardware.wifi.supplicant.DppAkm;
+import android.hardware.wifi.supplicant.DppConnectionKeys;
import android.hardware.wifi.supplicant.DppEventType;
import android.hardware.wifi.supplicant.DppFailureCode;
import android.hardware.wifi.supplicant.DppProgressCode;
@@ -41,7 +42,7 @@
* corresponding |ISupplicantStaIface.registerCallback| method.
*/
@VintfStability
-interface ISupplicantStaIfaceCallback {
+oneway interface ISupplicantStaIfaceCallback {
/**
* Used to indicate the result of ANQP (either for IEEE 802.11u Interworking
* or Hotspot 2.0) query.
@@ -52,7 +53,7 @@
* @param hs20Data ANQP data fetched from the Hotspot 2.0 access point.
* All the fields in this struct must be empty if the query failed.
*/
- oneway void onAnqpQueryDone(in byte[] bssid, in AnqpData data, in Hs20AnqpData hs20Data);
+ void onAnqpQueryDone(in byte[] bssid, in AnqpData data, in Hs20AnqpData hs20Data);
/**
* Used to indicate an association rejection received from the AP
@@ -60,14 +61,14 @@
*
* @param assocRejectData Association Rejection related information.
*/
- oneway void onAssociationRejected(in AssociationRejectionData assocRejectData);
+ void onAssociationRejected(in AssociationRejectionData assocRejectData);
/**
* Used to indicate the timeout of authentication to an AP.
*
* @param bssid BSSID of the corresponding AP.
*/
- oneway void onAuthenticationTimeout(in byte[] bssid);
+ void onAuthenticationTimeout(in byte[] bssid);
/**
* Indicates BTM request frame handling status.
@@ -75,7 +76,7 @@
* @param tmData Data retrieved from received BSS transition management
* request frame.
*/
- oneway void onBssTmHandlingDone(in BssTmData tmData);
+ void onBssTmHandlingDone(in BssTmData tmData);
/**
* Used to indicate the change of active bssid.
@@ -85,7 +86,7 @@
* @param reason Reason why the bssid changed.
* @param bssid BSSID of the corresponding AP.
*/
- oneway void onBssidChanged(in BssidChangeReason reason, in byte[] bssid);
+ void onBssidChanged(in BssidChangeReason reason, in byte[] bssid);
/**
* Used to indicate the disconnection from the currently connected
@@ -97,7 +98,7 @@
* @param reasonCode 802.11 code to indicate the disconnect reason
* from access point. Refer to section 8.4.1.7 of IEEE802.11 spec.
*/
- oneway void onDisconnected(
+ void onDisconnected(
in byte[] bssid, in boolean locallyGenerated, in StaIfaceReasonCode reasonCode);
/**
@@ -114,29 +115,31 @@
* bandList: A list of band parameters that are supported by the Enrollee expressed as the
* Operating Class.
*/
- oneway void onDppFailure(
+ void onDppFailure(
in DppFailureCode code, in String ssid, in String channelList, in char[] bandList);
/**
* Indicates a DPP progress event.
*/
- oneway void onDppProgress(in DppProgressCode code);
+ void onDppProgress(in DppProgressCode code);
/**
* Indicates a DPP success event.
*/
- oneway void onDppSuccess(in DppEventType event);
+ void onDppSuccess(in DppEventType event);
/**
- * Indicates DPP configuration received success event (Enrolee mode).
+ * Indicates DPP configuration received success event in Enrolee mode.
+ * This is also triggered when Configurator generates credentials for itself
+ * using generateSelfDppConfiguration() API
*/
- oneway void onDppSuccessConfigReceived(
- in byte[] ssid, in String password, in byte[] psk, in DppAkm securityAkm);
+ void onDppSuccessConfigReceived(in byte[] ssid, in String password, in byte[] psk,
+ in DppAkm securityAkm, in DppConnectionKeys dppConnectionKeys);
/**
* Indicates DPP configuration sent success event (Configurator mode).
*/
- oneway void onDppSuccessConfigSent();
+ void onDppSuccessConfigSent();
/**
* Indicates an EAP authentication failure.
@@ -144,21 +147,21 @@
* Either standard error code (enum EapErrorCode) or
* private error code defined by network provider.
*/
- oneway void onEapFailure(in int errorCode);
+ void onEapFailure(in int errorCode);
/**
* Used to indicate that the external radio work can start now.
*
* @param id Identifier generated for the radio work request.
*/
- oneway void onExtRadioWorkStart(in int id);
+ void onExtRadioWorkStart(in int id);
/**
* Used to indicate that the external radio work request has timed out.
*
* @param id Identifier generated for the radio work request.
*/
- oneway void onExtRadioWorkTimeout(in int id);
+ void onExtRadioWorkTimeout(in int id);
/**
* Used to indicate a Hotspot 2.0 imminent deauth notice.
@@ -169,7 +172,7 @@
* @param reAuthDelayInSec Delay before reauthenticating.
* @param url URL of the server.
*/
- oneway void onHs20DeauthImminentNotice(
+ void onHs20DeauthImminentNotice(
in byte[] bssid, in int reasonCode, in int reAuthDelayInSec, in String url);
/**
@@ -180,7 +183,7 @@
* @param data Icon data fetched from the access point.
* Must be empty if the query failed.
*/
- oneway void onHs20IconQueryDone(in byte[] bssid, in String fileName, in byte[] data);
+ void onHs20IconQueryDone(in byte[] bssid, in String fileName, in byte[] data);
/**
* Used to indicate a Hotspot 2.0 subscription remediation event.
@@ -189,8 +192,7 @@
* @param osuMethod OSU method.
* @param url URL of the server.
*/
- oneway void onHs20SubscriptionRemediation(
- in byte[] bssid, in OsuMethod osuMethod, in String url);
+ void onHs20SubscriptionRemediation(in byte[] bssid, in OsuMethod osuMethod, in String url);
/**
* Used to indicate a Hotspot 2.0 terms and conditions acceptance is requested from the user
@@ -199,15 +201,14 @@
* @param bssid BSSID of the access point.
* @param url URL of the T&C server.
*/
- oneway void onHs20TermsAndConditionsAcceptanceRequestedNotification(
- in byte[] bssid, in String url);
+ void onHs20TermsAndConditionsAcceptanceRequestedNotification(in byte[] bssid, in String url);
/**
* Used to indicate that a new network has been added.
*
* @param id Network ID allocated to the corresponding network.
*/
- oneway void onNetworkAdded(in int id);
+ void onNetworkAdded(in int id);
/**
* Used to indicate that the supplicant failed to find a network in scan result
@@ -216,14 +217,14 @@
*
* @param ssid network name supplicant tried to connect.
*/
- oneway void onNetworkNotFound(in byte[] ssid);
+ void onNetworkNotFound(in byte[] ssid);
/**
* Used to indicate that a network has been removed.
*
* @param id Network ID allocated to the corresponding network.
*/
- oneway void onNetworkRemoved(in int id);
+ void onNetworkRemoved(in int id);
/**
* Indicates pairwise master key (PMK) cache added event.
@@ -232,7 +233,7 @@
* @param serializedEntry is serialized PMK cache entry, the content is
* opaque for the framework and depends on the native implementation.
*/
- oneway void onPmkCacheAdded(in long expirationTimeInSec, in byte[] serializedEntry);
+ void onPmkCacheAdded(in long expirationTimeInSec, in byte[] serializedEntry);
/**
* Used to indicate a state change event on this particular iface. If this
@@ -253,7 +254,7 @@
* to a particular network.
* @param filsHlpSent If FILS HLP IEs were included in this association.
*/
- oneway void onStateChanged(in StaIfaceCallbackState newState, in byte[] bssid, in int id,
+ void onStateChanged(in StaIfaceCallbackState newState, in byte[] bssid, in int id,
in byte[] ssid, in boolean filsHlpSent);
/**
@@ -264,29 +265,29 @@
* @param configError Configuration error code.
* @param errorInd Error indication code.
*/
- oneway void onWpsEventFail(
+ void onWpsEventFail(
in byte[] bssid, in WpsConfigError configError, in WpsErrorIndication errorInd);
/**
* Used to indicate the overlap of a WPS PBC connection attempt.
*/
- oneway void onWpsEventPbcOverlap();
+ void onWpsEventPbcOverlap();
/**
* Used to indicate the success of a WPS connection attempt.
*/
- oneway void onWpsEventSuccess();
+ void onWpsEventSuccess();
/**
* Used to indicate that the AP has cleared all DSCP requests
* associated with this device.
*/
- oneway void onQosPolicyReset();
+ void onQosPolicyReset();
/**
* Used to indicate a DSCP request was received from the AP.
*
* @param qosPolicyData QoS policies info requested by the AP.
*/
- oneway void onQosPolicyRequest(in QosPolicyData[] qosPolicyData);
+ void onQosPolicyRequest(in QosPolicyData[] qosPolicyData);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl
index 1a2087d..267f1e8 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl
@@ -17,6 +17,7 @@
package android.hardware.wifi.supplicant;
import android.hardware.wifi.supplicant.AuthAlgMask;
+import android.hardware.wifi.supplicant.DppConnectionKeys;
import android.hardware.wifi.supplicant.EapMethod;
import android.hardware.wifi.supplicant.EapPhase2Method;
import android.hardware.wifi.supplicant.GroupCipherMask;
@@ -639,6 +640,18 @@
void setBssid(in byte[] bssid);
/**
+ * Set DPP keys for network which supports DPP AKM.
+ *
+ * @param keys connection keys needed to make DPP
+ * AKM based network connection.
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+ */
+ void setDppKeys(in DppConnectionKeys keys);
+
+ /**
* Set EAP Alt subject match for this network.
*
* @param match value to set.
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl
index 4024c35..de7b675 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl
@@ -29,14 +29,14 @@
* corresponding |ISupplicantStaNetwork.registerCallback| method.
*/
@VintfStability
-interface ISupplicantStaNetworkCallback {
+oneway interface ISupplicantStaNetworkCallback {
/**
* Used to request EAP Identity for this particular network.
*
* The response for the request must be sent using the corresponding
* |ISupplicantNetwork.sendNetworkEapIdentityResponse| call.
*/
- oneway void onNetworkEapIdentityRequest();
+ void onNetworkEapIdentityRequest();
/**
* Used to request EAP GSM SIM authentication for this particular network.
@@ -46,7 +46,7 @@
*
* @param params Params associated with the request.
*/
- oneway void onNetworkEapSimGsmAuthRequest(in NetworkRequestEapSimGsmAuthParams params);
+ void onNetworkEapSimGsmAuthRequest(in NetworkRequestEapSimGsmAuthParams params);
/**
* Used to request EAP UMTS SIM authentication for this particular network.
@@ -56,12 +56,12 @@
*
* @param params Params associated with the request.
*/
- oneway void onNetworkEapSimUmtsAuthRequest(in NetworkRequestEapSimUmtsAuthParams params);
+ void onNetworkEapSimUmtsAuthRequest(in NetworkRequestEapSimUmtsAuthParams params);
/**
* Used to notify WPA3 transition disable.
*/
- oneway void onTransitionDisable(in TransitionDisableIndication ind);
+ void onTransitionDisable(in TransitionDisableIndication ind);
/**
* Used to notify EAP certificate event.
@@ -69,6 +69,6 @@
* On receiving a server certifidate from TLS handshake, send this certificate
* to the framework for Trust On First Use.
*/
- oneway void onServerCertificateAvailable(
+ void onServerCertificateAvailable(
in int depth, in byte[] subject, in byte[] certHash, in byte[] certBlob);
}
diff --git a/drm/aidl/android/hardware/drm/DecryptResult.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl
similarity index 61%
rename from drm/aidl/android/hardware/drm/DecryptResult.aidl
rename to wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl
index 17e939b..0e23728 100644
--- a/drm/aidl/android/hardware/drm/DecryptResult.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl
@@ -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.
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package android.hardware.drm;
+package android.hardware.wifi.supplicant;
/**
- * The DecryptResult parcelable contains the result of
- * ICryptoPlugin decrypt method.
+ * Multi-Link Operation (MLO) Link IEEE Std 802.11-be.
+ * The information for MLO link needed by 802.11be standard.
*/
@VintfStability
-parcelable DecryptResult {
- /** The number of decrypted bytes. */
- int bytesWritten;
-
+parcelable MloLink {
/**
- * Vendor-specific error message if provided by the vendor's
- * crypto HAL.
+ * Link ID
*/
- String detailedError;
+ byte linkId;
+ /**
+ * STA Link MAC Address
+ */
+ byte[/* 6 */] staLinkMacAddress;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl
similarity index 62%
copy from bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
copy to wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl
index 2cf019e..2f14717 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioMode.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright 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.
@@ -14,12 +14,18 @@
* limitations under the License.
*/
-package android.hardware.bluetooth.audio;
+package android.hardware.wifi.supplicant;
+import android.hardware.wifi.supplicant.MloLink;
+
+/**
+ * Multi-Link Operation (MLO) Links info.
+ * The information for MLO links needed by 802.11be standard.
+ */
@VintfStability
-@Backing(type="byte")
-enum LeAudioMode {
- UNKNOWN,
- UNICAST,
- BROADCAST,
+parcelable MloLinksInfo {
+ /**
+ * List of MLO links
+ */
+ MloLink[] links;
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl
new file mode 100644
index 0000000..06e834b
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pFrameTypeMask.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.wifi.supplicant;
+
+/**
+ * Bitmask of P2P frame types.
+ */
+@VintfStability
+@Backing(type="int")
+enum P2pFrameTypeMask {
+ /** P2P probe request frame */
+ P2P_FRAME_PROBE_REQ_P2P = 1 << 0,
+ /** P2P probe response frame */
+ P2P_FRAME_PROBE_RESP_P2P = 1 << 1,
+ /** P2P probe response frame from the group owner */
+ P2P_FRAME_PROBE_RESP_P2P_GO = 1 << 2,
+ /** Beacon frame from the group owner */
+ P2P_FRAME_BEACON_P2P_GO = 1 << 3,
+ /** Provision discovery request frame */
+ P2P_FRAME_P2P_PD_REQ = 1 << 4,
+ /** Provision discovery response frame */
+ P2P_FRAME_P2P_PD_RESP = 1 << 5,
+ /** Group negotiation request frame */
+ P2P_FRAME_P2P_GO_NEG_REQ = 1 << 6,
+ /** Group negotiation response frame */
+ P2P_FRAME_P2P_GO_NEG_RESP = 1 << 7,
+ /** Group negotiation confirm frame */
+ P2P_FRAME_P2P_GO_NEG_CONF = 1 << 8,
+ /** Invitation request frame */
+ P2P_FRAME_P2P_INV_REQ = 1 << 9,
+ /** Invitation response frame */
+ P2P_FRAME_P2P_INV_RESP = 1 << 10,
+ /** P2P Association request frame */
+ P2P_FRAME_P2P_ASSOC_REQ = 1 << 11,
+ /** P2P Association response frame */
+ P2P_FRAME_P2P_ASSOC_RESP = 1 << 12,
+}
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 90ca215..d95bd03 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
@@ -34,6 +34,7 @@
using aidl::android::hardware::wifi::supplicant::ISupplicant;
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::P2pProvDiscStatusCode;
using aidl::android::hardware::wifi::supplicant::P2pStatusCode;
@@ -163,6 +164,17 @@
int32_t /* frequency */) override {
return ndk::ScopedAStatus::ok();
}
+ ::ndk::ScopedAStatus onDeviceFoundWithVendorElements(
+ const std::vector<uint8_t>& /* srcAddress */,
+ const std::vector<uint8_t>& /* p2pDeviceAddress */,
+ const std::vector<uint8_t>& /* primaryDeviceType */,
+ const std::string& /* deviceName */, WpsConfigMethods /* configMethods */,
+ int8_t /* deviceCapabilities */, P2pGroupCapabilityMask /* groupCapabilities */,
+ const std::vector<uint8_t>& /* wfdDeviceInfo */,
+ const std::vector<uint8_t>& /* wfdR2DeviceInfo */,
+ const std::vector<uint8_t>& /* vendorElemBytes */) override {
+ return ndk::ScopedAStatus::ok();
+ }
};
class SupplicantP2pIfaceAidlTest : public testing::TestWithParam<std::string> {
@@ -637,6 +649,21 @@
p2p_iface_->removeUpnpService(0 /* version */, upnpServiceName).isOk());
}
+/*
+ * SetVendorElements
+ */
+TEST_P(SupplicantP2pIfaceAidlTest, SetVendorElements) {
+ LOG(INFO) << "SupplicantP2pIfaceAidlTest::SetVendorElements start";
+
+ std::vector<uint8_t> vendorElemBytes;
+ EXPECT_TRUE(
+ p2p_iface_
+ ->setVendorElements(P2pFrameTypeMask::P2P_FRAME_PROBE_RESP_P2P, vendorElemBytes)
+ .isOk());
+
+ LOG(INFO) << "SupplicantP2pIfaceAidlTest::SetVendorElements end";
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantP2pIfaceAidlTest);
INSTANTIATE_TEST_SUITE_P(Supplicant, SupplicantP2pIfaceAidlTest,
testing::ValuesIn(android::getAidlHalInstanceNames(
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 c163864..fdafe08 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
@@ -33,6 +33,7 @@
using aidl::android::hardware::wifi::supplicant::ConnectionCapabilities;
using aidl::android::hardware::wifi::supplicant::DebugLevel;
using aidl::android::hardware::wifi::supplicant::DppAkm;
+using aidl::android::hardware::wifi::supplicant::DppConnectionKeys;
using aidl::android::hardware::wifi::supplicant::DppCurve;
using aidl::android::hardware::wifi::supplicant::DppNetRole;
using aidl::android::hardware::wifi::supplicant::DppResponderBootstrapInfo;
@@ -112,11 +113,11 @@
return ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus onDppSuccessConfigReceived(
- const std::vector<uint8_t>& /* ssid */,
- const std::string& /* password */,
- const std::vector<uint8_t>& /* psk */,
- ::aidl::android::hardware::wifi::supplicant::DppAkm /* securityAkm */)
- override {
+ const std::vector<uint8_t>& /* ssid */, const std::string& /* password */,
+ const std::vector<uint8_t>& /* psk */,
+ ::aidl::android::hardware::wifi::supplicant::DppAkm /* securityAkm */,
+ const ::aidl::android::hardware::wifi::supplicant::
+ DppConnectionKeys& /* DppConnectionKeys */) override {
return ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus onDppSuccessConfigSent() override {
@@ -755,14 +756,16 @@
"6D795F746573745F73736964"; // 'my_test_ssid' encoded in hex
const std::string password =
"746F70736563726574"; // 'topsecret' encoded in hex
+ const std::vector<uint8_t> eckey_in = {0x2, 0x3, 0x4};
+ std::vector<uint8_t> eckey_out = {};
// Start DPP as Configurator-Initiator. Since this operation requires two
// devices, we start the operation and expect a timeout.
EXPECT_TRUE(sta_iface_
- ->startDppConfiguratorInitiator(peer_id, 0, ssid, password,
- "", DppNetRole::STA,
- DppAkm::PSK)
- .isOk());
+ ->startDppConfiguratorInitiator(peer_id, 0, ssid, password, "",
+ DppNetRole::STA, DppAkm::PSK, eckey_in,
+ &eckey_out)
+ .isOk());
// Wait for the timeout callback
ASSERT_EQ(std::cv_status::no_timeout,