Merge "Wifi: Add 802.11ax support to RTT"
diff --git a/boot/1.1/default/service.cpp b/boot/1.1/default/service.cpp
index 93eaeda..89251b5 100644
--- a/boot/1.1/default/service.cpp
+++ b/boot/1.1/default/service.cpp
@@ -15,12 +15,13 @@
*/
#define LOG_TAG "android.hardware.boot@1.1-service"
-#include <android/hardware/boot/1.0/IBootControl.h>
+#include <android/hardware/boot/1.1/IBootControl.h>
#include <hidl/LegacySupport.h>
using android::hardware::defaultPassthroughServiceImplementation;
-using ::android::hardware::boot::V1_0::IBootControl;
+using IBootControl_V1_0 = android::hardware::boot::V1_0::IBootControl;
+using IBootControl_V1_1 = android::hardware::boot::V1_1::IBootControl;
int main(int /* argc */, char* /* argv */[]) {
- return defaultPassthroughServiceImplementation<IBootControl>();
+ return defaultPassthroughServiceImplementation<IBootControl_V1_0, IBootControl_V1_1>();
}
diff --git a/tetheroffload/config/1.0/vts/functional/Android.bp b/tetheroffload/config/1.0/vts/functional/Android.bp
index 52b9810..7b472e3 100644
--- a/tetheroffload/config/1.0/vts/functional/Android.bp
+++ b/tetheroffload/config/1.0/vts/functional/Android.bp
@@ -17,5 +17,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalTetheroffloadConfigV1_0TargetTest.cpp"],
static_libs: ["android.hardware.tetheroffload.config@1.0"],
- test_suites: ["general-tests"],
+ test_suites: ["general-tests", "vts-core"],
}
diff --git a/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp b/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
index 34a95f2..02fe96f 100644
--- a/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
+++ b/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
@@ -16,11 +16,12 @@
#define LOG_TAG "VtsOffloadConfigV1_0TargetTest"
-#include <VtsHalHidlTargetTestBase.h>
-#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <android/hardware/tetheroffload/config/1.0/IOffloadConfig.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
#include <linux/netfilter/nfnetlink.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
@@ -78,25 +79,10 @@
return netlinkSocket(NETLINK_NETFILTER, groups);
}
-// Test environment for OffloadConfig HIDL HAL.
-class OffloadConfigHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
- // get the test environment singleton
- static OffloadConfigHidlEnvironment* Instance() {
- static OffloadConfigHidlEnvironment* instance = new OffloadConfigHidlEnvironment;
- return instance;
- }
-
- virtual void registerTestServices() override { registerTestService<IOffloadConfig>(); }
- private:
- OffloadConfigHidlEnvironment() {}
-};
-
-class OffloadConfigHidlTest : public testing::VtsHalHidlTargetTestBase {
+class OffloadConfigHidlTest : public testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
- config = testing::VtsHalHidlTargetTestBase::getService<IOffloadConfig>(
- OffloadConfigHidlEnvironment::Instance()->getServiceName<IOffloadConfig>());
+ config = IOffloadConfig::getService(GetParam());
ASSERT_NE(nullptr, config.get()) << "Could not get HIDL instance";
}
@@ -106,7 +92,7 @@
};
// Ensure handles can be set with correct socket options.
-TEST_F(OffloadConfigHidlTest, TestSetHandles) {
+TEST_P(OffloadConfigHidlTest, TestSetHandles) {
// Try multiple times in a row to see if it provokes file descriptor leaks.
for (int i = 0; i < 1024; i++) {
unique_fd fd1(netlinkSocket(kFd1Groups));
@@ -136,7 +122,7 @@
// Passing a handle without an associated file descriptor should return an error
// (e.g. "Failed Input Checks"). Check that this occurs when both FDs are empty.
-TEST_F(OffloadConfigHidlTest, TestSetHandleNone) {
+TEST_P(OffloadConfigHidlTest, TestSetHandleNone) {
native_handle_t* const nativeHandle1 = native_handle_create(0, 0);
hidl_handle h1;
h1.setTo(nativeHandle1, true);
@@ -150,7 +136,7 @@
// Passing a handle without an associated file descriptor should return an error
// (e.g. "Failed Input Checks"). Check that this occurs when FD2 is empty.
-TEST_F(OffloadConfigHidlTest, TestSetHandle1Only) {
+TEST_P(OffloadConfigHidlTest, TestSetHandle1Only) {
unique_fd fd1(netlinkSocket(kFd1Groups));
if (fd1.get() < 0) {
ALOGE("Unable to create conntrack handles: %d/%s", errno, strerror(errno));
@@ -171,7 +157,7 @@
// Passing a handle without an associated file descriptor should return an error
// (e.g. "Failed Input Checks"). Check that this occurs when FD1 is empty.
-TEST_F(OffloadConfigHidlTest, TestSetHandle2OnlyNotOk) {
+TEST_P(OffloadConfigHidlTest, TestSetHandle2OnlyNotOk) {
native_handle_t* const nativeHandle1 = native_handle_create(0, 0);
hidl_handle h1;
h1.setTo(nativeHandle1, true);
@@ -190,11 +176,7 @@
ASSERT_TRUE(ret.isOk());
}
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(OffloadConfigHidlEnvironment::Instance());
- ::testing::InitGoogleTest(&argc, argv);
- OffloadConfigHidlEnvironment::Instance()->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- ALOGE("Test result with status=%d", status);
- return status;
-}
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, OffloadConfigHidlTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(IOffloadConfig::descriptor)),
+ android::hardware::PrintInstanceNameToString);
diff --git a/vibrator/staidl/Android.bp b/vibrator/aidl/Android.bp
similarity index 100%
rename from vibrator/staidl/Android.bp
rename to vibrator/aidl/Android.bp
diff --git a/vibrator/staidl/android/hardware/vibrator/Effect.aidl b/vibrator/aidl/android/hardware/vibrator/Effect.aidl
similarity index 100%
rename from vibrator/staidl/android/hardware/vibrator/Effect.aidl
rename to vibrator/aidl/android/hardware/vibrator/Effect.aidl
diff --git a/vibrator/staidl/android/hardware/vibrator/EffectStrength.aidl b/vibrator/aidl/android/hardware/vibrator/EffectStrength.aidl
similarity index 100%
rename from vibrator/staidl/android/hardware/vibrator/EffectStrength.aidl
rename to vibrator/aidl/android/hardware/vibrator/EffectStrength.aidl
diff --git a/vibrator/staidl/android/hardware/vibrator/IVibrator.aidl b/vibrator/aidl/android/hardware/vibrator/IVibrator.aidl
similarity index 94%
rename from vibrator/staidl/android/hardware/vibrator/IVibrator.aidl
rename to vibrator/aidl/android/hardware/vibrator/IVibrator.aidl
index b2008f4..d21274b 100644
--- a/vibrator/staidl/android/hardware/vibrator/IVibrator.aidl
+++ b/vibrator/aidl/android/hardware/vibrator/IVibrator.aidl
@@ -74,6 +74,14 @@
int perform(in Effect effect, in EffectStrength strength, in IVibratorCallback callback);
/**
+ * List supported effects.
+ *
+ * Return the effects which are supported (an effect is expected to be supported at every
+ * strength level.
+ */
+ Effect[] getSupportedEffects();
+
+ /**
* Sets the motor's vibrational amplitude.
*
* Changes the force being produced by the underlying motor.
diff --git a/vibrator/staidl/android/hardware/vibrator/IVibratorCallback.aidl b/vibrator/aidl/android/hardware/vibrator/IVibratorCallback.aidl
similarity index 100%
rename from vibrator/staidl/android/hardware/vibrator/IVibratorCallback.aidl
rename to vibrator/aidl/android/hardware/vibrator/IVibratorCallback.aidl
diff --git a/vibrator/staidl/default/Android.bp b/vibrator/aidl/default/Android.bp
similarity index 100%
rename from vibrator/staidl/default/Android.bp
rename to vibrator/aidl/default/Android.bp
diff --git a/vibrator/staidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp
similarity index 94%
rename from vibrator/staidl/default/Vibrator.cpp
rename to vibrator/aidl/default/Vibrator.cpp
index cdf8e09..2aec8c5 100644
--- a/vibrator/staidl/default/Vibrator.cpp
+++ b/vibrator/aidl/default/Vibrator.cpp
@@ -78,6 +78,11 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Vibrator::getSupportedEffects(std::vector<Effect>* _aidl_return) {
+ *_aidl_return = {Effect::CLICK, Effect::TICK};
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus Vibrator::setAmplitude(int32_t amplitude) {
LOG(INFO) << "Vibrator set amplitude: " << amplitude;
if (amplitude <= 0 || amplitude > 255) {
diff --git a/vibrator/staidl/default/Vibrator.h b/vibrator/aidl/default/Vibrator.h
similarity index 94%
rename from vibrator/staidl/default/Vibrator.h
rename to vibrator/aidl/default/Vibrator.h
index 77e96e3..14e7292 100644
--- a/vibrator/staidl/default/Vibrator.h
+++ b/vibrator/aidl/default/Vibrator.h
@@ -31,6 +31,7 @@
ndk::ScopedAStatus perform(Effect effect, EffectStrength strength,
const std::shared_ptr<IVibratorCallback>& callback,
int32_t* _aidl_return) override;
+ ndk::ScopedAStatus getSupportedEffects(std::vector<Effect>* _aidl_return) override;
ndk::ScopedAStatus setAmplitude(int32_t amplitude) override;
ndk::ScopedAStatus setExternalControl(bool enabled) override;
};
diff --git a/vibrator/staidl/default/main.cpp b/vibrator/aidl/default/main.cpp
similarity index 100%
rename from vibrator/staidl/default/main.cpp
rename to vibrator/aidl/default/main.cpp
diff --git a/vibrator/staidl/default/vibrator-default.rc b/vibrator/aidl/default/vibrator-default.rc
similarity index 100%
rename from vibrator/staidl/default/vibrator-default.rc
rename to vibrator/aidl/default/vibrator-default.rc
diff --git a/vibrator/staidl/default/vibrator-default.xml b/vibrator/aidl/default/vibrator-default.xml
similarity index 100%
rename from vibrator/staidl/default/vibrator-default.xml
rename to vibrator/aidl/default/vibrator-default.xml
diff --git a/vibrator/staidl/vts/Android.bp b/vibrator/aidl/vts/Android.bp
similarity index 100%
rename from vibrator/staidl/vts/Android.bp
rename to vibrator/aidl/vts/Android.bp
diff --git a/vibrator/staidl/vts/VtsHalVibratorTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
similarity index 89%
rename from vibrator/staidl/vts/VtsHalVibratorTargetTest.cpp
rename to vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
index 33bcaf5..b0e6c72 100644
--- a/vibrator/staidl/vts/VtsHalVibratorTargetTest.cpp
+++ b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
@@ -32,6 +32,7 @@
using android::hardware::vibrator::EffectStrength;
using android::hardware::vibrator::IVibrator;
+// TODO(b/143992652): autogenerate
const std::vector<Effect> kEffects = {
Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::THUD,
Effect::POP, Effect::HEAVY_CLICK, Effect::RINGTONE_1, Effect::RINGTONE_2,
@@ -40,6 +41,7 @@
Effect::RINGTONE_11, Effect::RINGTONE_12, Effect::RINGTONE_13, Effect::RINGTONE_14,
Effect::RINGTONE_15, Effect::TEXTURE_TICK};
+// TODO(b/143992652): autogenerate
const std::vector<EffectStrength> kEffectStrengths = {EffectStrength::LIGHT, EffectStrength::MEDIUM,
EffectStrength::STRONG};
@@ -105,15 +107,22 @@
}
TEST_P(VibratorAidl, ValidateEffect) {
+ std::vector<Effect> supported;
+ ASSERT_TRUE(vibrator->getSupportedEffects(&supported).isOk());
+
for (Effect effect : kEffects) {
+ bool isEffectSupported =
+ std::find(supported.begin(), supported.end(), effect) != supported.end();
+
for (EffectStrength strength : kEffectStrengths) {
int32_t lengthMs = 0;
Status status = vibrator->perform(effect, strength, nullptr /*callback*/, &lengthMs);
- EXPECT_TRUE(status.isOk() ||
- status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION);
- if (status.isOk()) {
+
+ if (isEffectSupported) {
+ EXPECT_TRUE(status.isOk());
EXPECT_GT(lengthMs, 0);
} else {
+ EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION);
EXPECT_EQ(lengthMs, 0);
}
}
@@ -123,16 +132,29 @@
TEST_P(VibratorAidl, ValidateEffectWithCallback) {
if (!(capabilities & IVibrator::CAP_PERFORM_CALLBACK)) return;
+ std::vector<Effect> supported;
+ ASSERT_TRUE(vibrator->getSupportedEffects(&supported).isOk());
+
for (Effect effect : kEffects) {
+ bool isEffectSupported =
+ std::find(supported.begin(), supported.end(), effect) != supported.end();
+
for (EffectStrength strength : kEffectStrengths) {
std::promise<void> completionPromise;
std::future<void> completionFuture{completionPromise.get_future()};
sp<CompletionCallback> callback =
new CompletionCallback([&completionPromise] { completionPromise.set_value(); });
- int lengthMs;
+ int lengthMs = 0;
Status status = vibrator->perform(effect, strength, callback, &lengthMs);
- EXPECT_TRUE(status.isOk() ||
- status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION);
+
+ if (isEffectSupported) {
+ EXPECT_TRUE(status.isOk());
+ EXPECT_GT(lengthMs, 0);
+ } else {
+ EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION);
+ EXPECT_EQ(lengthMs, 0);
+ }
+
if (!status.isOk()) continue;
std::chrono::milliseconds timeout{lengthMs * 2};