Merge "vibrator: Support Always-On Effects"
diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp
index 21dab00..c6c9464 100644
--- a/audio/core/all-versions/default/Device.cpp
+++ b/audio/core/all-versions/default/Device.cpp
@@ -84,26 +84,29 @@
ALOGW("Can not set a master volume (%f) outside [0,1]", volume);
return Result::INVALID_ARGUMENTS;
}
- return analyzeStatus("set_master_volume", mDevice->set_master_volume(mDevice, volume));
+ return analyzeStatus("set_master_volume", mDevice->set_master_volume(mDevice, volume),
+ {ENOSYS} /*ignore*/);
}
Return<void> Device::getMasterVolume(getMasterVolume_cb _hidl_cb) {
Result retval(Result::NOT_SUPPORTED);
float volume = 0;
if (mDevice->get_master_volume != NULL) {
- retval = analyzeStatus("get_master_volume", mDevice->get_master_volume(mDevice, &volume));
+ retval = analyzeStatus("get_master_volume", mDevice->get_master_volume(mDevice, &volume),
+ {ENOSYS} /*ignore*/);
}
_hidl_cb(retval, volume);
return Void();
}
Return<Result> Device::setMicMute(bool mute) {
- return analyzeStatus("set_mic_mute", mDevice->set_mic_mute(mDevice, mute));
+ return analyzeStatus("set_mic_mute", mDevice->set_mic_mute(mDevice, mute), {ENOSYS} /*ignore*/);
}
Return<void> Device::getMicMute(getMicMute_cb _hidl_cb) {
bool mute = false;
- Result retval = analyzeStatus("get_mic_mute", mDevice->get_mic_mute(mDevice, &mute));
+ Result retval = analyzeStatus("get_mic_mute", mDevice->get_mic_mute(mDevice, &mute),
+ {ENOSYS} /*ignore*/);
_hidl_cb(retval, mute);
return Void();
}
@@ -111,7 +114,8 @@
Return<Result> Device::setMasterMute(bool mute) {
Result retval(Result::NOT_SUPPORTED);
if (mDevice->set_master_mute != NULL) {
- retval = analyzeStatus("set_master_mute", mDevice->set_master_mute(mDevice, mute));
+ retval = analyzeStatus("set_master_mute", mDevice->set_master_mute(mDevice, mute),
+ {ENOSYS} /*ignore*/);
}
return retval;
}
@@ -120,7 +124,8 @@
Result retval(Result::NOT_SUPPORTED);
bool mute = false;
if (mDevice->get_master_mute != NULL) {
- retval = analyzeStatus("get_master_mute", mDevice->get_master_mute(mDevice, &mute));
+ retval = analyzeStatus("get_master_mute", mDevice->get_master_mute(mDevice, &mute),
+ {ENOSYS} /*ignore*/);
}
_hidl_cb(retval, mute);
return Void();
diff --git a/audio/core/all-versions/default/StreamOut.cpp b/audio/core/all-versions/default/StreamOut.cpp
index 396d354..1a2a764 100644
--- a/audio/core/all-versions/default/StreamOut.cpp
+++ b/audio/core/all-versions/default/StreamOut.cpp
@@ -318,7 +318,8 @@
ALOGW("Can not set a stream output volume {%f, %f} outside [0,1]", left, right);
return Result::INVALID_ARGUMENTS;
}
- return Stream::analyzeStatus("set_volume", mStream->set_volume(mStream, left, right));
+ return Stream::analyzeStatus("set_volume", mStream->set_volume(mStream, left, right),
+ {ENOSYS} /*ignore*/);
}
Return<void> StreamOut::prepareForWriting(uint32_t frameSize, uint32_t framesCount,
@@ -403,7 +404,8 @@
Return<void> StreamOut::getRenderPosition(getRenderPosition_cb _hidl_cb) {
uint32_t halDspFrames;
Result retval = Stream::analyzeStatus("get_render_position",
- mStream->get_render_position(mStream, &halDspFrames));
+ mStream->get_render_position(mStream, &halDspFrames),
+ {ENOSYS} /*ignore*/);
_hidl_cb(retval, halDspFrames);
return Void();
}
@@ -413,7 +415,8 @@
int64_t timestampUs = 0;
if (mStream->get_next_write_timestamp != NULL) {
retval = Stream::analyzeStatus("get_next_write_timestamp",
- mStream->get_next_write_timestamp(mStream, ×tampUs));
+ mStream->get_next_write_timestamp(mStream, ×tampUs),
+ {ENOSYS} /*ignore*/);
}
_hidl_cb(retval, timestampUs);
return Void();
@@ -427,7 +430,7 @@
if (result == 0) {
mCallback = callback;
}
- return Stream::analyzeStatus("set_callback", result);
+ return Stream::analyzeStatus("set_callback", result, {ENOSYS} /*ignore*/);
}
Return<Result> StreamOut::clearCallback() {
@@ -473,13 +476,15 @@
}
Return<Result> StreamOut::pause() {
- return mStream->pause != NULL ? Stream::analyzeStatus("pause", mStream->pause(mStream))
- : Result::NOT_SUPPORTED;
+ return mStream->pause != NULL
+ ? Stream::analyzeStatus("pause", mStream->pause(mStream), {ENOSYS} /*ignore*/)
+ : Result::NOT_SUPPORTED;
}
Return<Result> StreamOut::resume() {
- return mStream->resume != NULL ? Stream::analyzeStatus("resume", mStream->resume(mStream))
- : Result::NOT_SUPPORTED;
+ return mStream->resume != NULL
+ ? Stream::analyzeStatus("resume", mStream->resume(mStream), {ENOSYS} /*ignore*/)
+ : Result::NOT_SUPPORTED;
}
Return<bool> StreamOut::supportsDrain() {
@@ -488,14 +493,17 @@
Return<Result> StreamOut::drain(AudioDrain type) {
return mStream->drain != NULL
- ? Stream::analyzeStatus(
- "drain", mStream->drain(mStream, static_cast<audio_drain_type_t>(type)))
- : Result::NOT_SUPPORTED;
+ ? Stream::analyzeStatus(
+ "drain",
+ mStream->drain(mStream, static_cast<audio_drain_type_t>(type)),
+ {ENOSYS} /*ignore*/)
+ : Result::NOT_SUPPORTED;
}
Return<Result> StreamOut::flush() {
- return mStream->flush != NULL ? Stream::analyzeStatus("flush", mStream->flush(mStream))
- : Result::NOT_SUPPORTED;
+ return mStream->flush != NULL
+ ? Stream::analyzeStatus("flush", mStream->flush(mStream), {ENOSYS} /*ignore*/)
+ : Result::NOT_SUPPORTED;
}
// static
@@ -505,7 +513,7 @@
// to return it sometimes. EAGAIN may be returned by A2DP audio HAL
// implementation. ENODATA can also be reported while the writer is
// continuously querying it, but the stream has been stopped.
- static const std::vector<int> ignoredErrors{EINVAL, EAGAIN, ENODATA};
+ static const std::vector<int> ignoredErrors{EINVAL, EAGAIN, ENODATA, ENOSYS};
Result retval(Result::NOT_SUPPORTED);
if (stream->get_presentation_position == NULL) return retval;
struct timespec halTimeStamp;
diff --git a/broadcastradio/2.0/vts/OWNERS b/broadcastradio/2.0/vts/OWNERS
index 12adf57..1ff7407 100644
--- a/broadcastradio/2.0/vts/OWNERS
+++ b/broadcastradio/2.0/vts/OWNERS
@@ -3,5 +3,4 @@
twasilczyk@google.com
# VTS team
-yuexima@google.com
-yim@google.com
+dshi@google.com
diff --git a/broadcastradio/2.0/vts/functional/Android.bp b/broadcastradio/2.0/vts/functional/Android.bp
index 3e18a54..49bb665 100644
--- a/broadcastradio/2.0/vts/functional/Android.bp
+++ b/broadcastradio/2.0/vts/functional/Android.bp
@@ -17,9 +17,6 @@
cc_test {
name: "VtsHalBroadcastradioV2_0TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
- cppflags: [
- "-std=c++1z",
- ],
srcs: ["VtsHalBroadcastradioV2_0TargetTest.cpp"],
static_libs: [
"android.hardware.broadcastradio@2.0",
@@ -28,5 +25,8 @@
"android.hardware.broadcastradio@vts-utils-lib",
"libgmock",
],
- test_suites: ["general-tests"],
+ test_suites: [
+ "general-tests",
+ "vts-core",
+ ],
}
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index e36f4d9..d170a6d 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -16,7 +16,6 @@
#define EGMOCK_VERBOSE 1
-#include <VtsHalHidlTargetTestBase.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include <android/hardware/broadcastradio/2.0/IBroadcastRadio.h>
@@ -25,11 +24,13 @@
#include <android/hardware/broadcastradio/2.0/types.h>
#include <broadcastradio-utils-2x/Utils.h>
#include <broadcastradio-vts-utils/call-barrier.h>
-#include <broadcastradio-vts-utils/environment-utils.h>
#include <broadcastradio-vts-utils/mock-timeout.h>
#include <broadcastradio-vts-utils/pointer-utils.h>
#include <cutils/bitops.h>
#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
#include <chrono>
#include <optional>
@@ -52,7 +53,6 @@
using testing::Invoke;
using testing::SaveArg;
-using broadcastradio::vts::BroadcastRadioHidlEnvironment;
using broadcastradio::vts::CallBarrier;
using broadcastradio::vts::clearAndWait;
using utils::make_identifier;
@@ -100,10 +100,8 @@
MOCK_METHOD1(onListUpdated, Return<void>(const hidl_vec<Announcement>&));
};
-static BroadcastRadioHidlEnvironment<IBroadcastRadio>* gEnv = nullptr;
-
-class BroadcastRadioHalTest : public ::testing::VtsHalHidlTargetTestBase {
- protected:
+class BroadcastRadioHalTest : public ::testing::TestWithParam<std::string> {
+ protected:
virtual void SetUp() override;
virtual void TearDown() override;
@@ -185,7 +183,7 @@
EXPECT_EQ(nullptr, mModule.get()) << "Module is already open";
// lookup HIDL service (radio module)
- mModule = getService<IBroadcastRadio>(gEnv->getServiceName<IBroadcastRadio>());
+ mModule = IBroadcastRadio::getService(GetParam());
ASSERT_NE(nullptr, mModule.get()) << "Couldn't find broadcast radio HAL implementation";
// get module properties
@@ -243,10 +241,10 @@
auto startResult = mSession->startProgramListUpdates({});
if (startResult == Result::NOT_SUPPORTED) {
printSkipped("Program list not supported");
- return nullopt;
+ return std::nullopt;
}
EXPECT_EQ(Result::OK, startResult);
- if (startResult != Result::OK) return nullopt;
+ if (startResult != Result::OK) return std::nullopt;
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onProgramListReady, timeout::programListScan);
@@ -264,7 +262,7 @@
* - the method succeeds when called for the second time without
* closing previous session.
*/
-TEST_F(BroadcastRadioHalTest, OpenSession) {
+TEST_P(BroadcastRadioHalTest, OpenSession) {
// simply open session for the first time
ASSERT_TRUE(openSession());
@@ -308,7 +306,7 @@
* - all channel grids (frequency ranges and spacings) are valid;
* - seek spacing is a multiple of the manual spacing value.
*/
-TEST_F(BroadcastRadioHalTest, GetAmFmRegionConfig) {
+TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfig) {
AmFmRegionConfig config;
bool supported = getAmFmRegionConfig(false, &config);
if (!supported) {
@@ -341,7 +339,7 @@
* - all channel grids (frequency ranges and spacings) are valid;
* - seek spacing is not set.
*/
-TEST_F(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilities) {
+TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilities) {
AmFmRegionConfig config;
bool supported = getAmFmRegionConfig(true, &config);
if (!supported) {
@@ -369,7 +367,7 @@
* - all channel labels match correct format;
* - all channel frequencies are in correct range.
*/
-TEST_F(BroadcastRadioHalTest, GetDabRegionConfig) {
+TEST_P(BroadcastRadioHalTest, GetDabRegionConfig) {
Result halResult;
hidl_vec<DabTableEntry> config;
auto cb = [&](Result result, hidl_vec<DabTableEntry> configCb) {
@@ -411,7 +409,7 @@
* invoked carrying a proper selector;
* - program changes exactly to what was requested.
*/
-TEST_F(BroadcastRadioHalTest, FmTune) {
+TEST_P(BroadcastRadioHalTest, FmTune) {
ASSERT_TRUE(openSession());
uint64_t freq = 100100; // 100.1 FM
@@ -458,7 +456,7 @@
* - if the selector is not supported, it's ignored;
* - if it is supported, an invalid value results with INVALID_ARGUMENTS;
*/
-TEST_F(BroadcastRadioHalTest, TuneFailsWithInvalid) {
+TEST_P(BroadcastRadioHalTest, TuneFailsWithInvalid) {
ASSERT_TRUE(openSession());
vector<ProgramIdentifier> invalid = {
@@ -489,7 +487,7 @@
* Verifies that:
* - tune fails with NOT_SUPPORTED when program selector is not initialized.
*/
-TEST_F(BroadcastRadioHalTest, TuneFailsWithEmpty) {
+TEST_P(BroadcastRadioHalTest, TuneFailsWithEmpty) {
ASSERT_TRUE(openSession());
// Program type is 1-based, so 0 will always be invalid.
@@ -506,7 +504,7 @@
* - the program info is changed within timeout::tune;
* - works both directions and with or without skipping sub-channel.
*/
-TEST_F(BroadcastRadioHalTest, Seek) {
+TEST_P(BroadcastRadioHalTest, Seek) {
ASSERT_TRUE(openSession());
// TODO(b/69958777): see FmTune workaround
@@ -531,7 +529,7 @@
* - the program info is changed within timeout::tune if the method succeeded;
* - works both directions.
*/
-TEST_F(BroadcastRadioHalTest, Step) {
+TEST_P(BroadcastRadioHalTest, Step) {
ASSERT_TRUE(openSession());
// TODO(b/69958777): see FmTune workaround
@@ -558,7 +556,7 @@
* Verifies that:
* - the method does not crash after being invoked multiple times.
*/
-TEST_F(BroadcastRadioHalTest, Cancel) {
+TEST_P(BroadcastRadioHalTest, Cancel) {
ASSERT_TRUE(openSession());
for (int i = 0; i < 10; i++) {
@@ -576,7 +574,7 @@
* Verifies that:
* - callback is called for empty parameters set.
*/
-TEST_F(BroadcastRadioHalTest, NoParameters) {
+TEST_P(BroadcastRadioHalTest, NoParameters) {
ASSERT_TRUE(openSession());
hidl_vec<VendorKeyValue> halResults = {};
@@ -605,7 +603,7 @@
* - unknown parameters are ignored;
* - callback is called also for empty results set.
*/
-TEST_F(BroadcastRadioHalTest, UnknownParameters) {
+TEST_P(BroadcastRadioHalTest, UnknownParameters) {
ASSERT_TRUE(openSession());
hidl_vec<VendorKeyValue> halResults = {};
@@ -633,7 +631,7 @@
* Verifies that:
* - the method does not crash after being invoked multiple times.
*/
-TEST_F(BroadcastRadioHalTest, Close) {
+TEST_P(BroadcastRadioHalTest, Close) {
ASSERT_TRUE(openSession());
for (int i = 0; i < 10; i++) {
@@ -648,7 +646,7 @@
* Verifies that:
* - getImage call handles argument 0 gracefully.
*/
-TEST_F(BroadcastRadioHalTest, GetNoImage) {
+TEST_P(BroadcastRadioHalTest, GetNoImage) {
size_t len = 0;
auto result = mModule->getImage(0, [&](hidl_vec<uint8_t> rawImage) { len = rawImage.size(); });
@@ -663,7 +661,7 @@
* - isConfigFlagSet either succeeds or ends with NOT_SUPPORTED or INVALID_STATE;
* - call success or failure is consistent with setConfigFlag.
*/
-TEST_F(BroadcastRadioHalTest, FetchConfigFlags) {
+TEST_P(BroadcastRadioHalTest, FetchConfigFlags) {
ASSERT_TRUE(openSession());
for (auto flag : gConfigFlagValues) {
@@ -691,7 +689,7 @@
* - setConfigFlag either succeeds or ends with NOT_SUPPORTED or INVALID_STATE;
* - isConfigFlagSet reflects the state requested immediately after the set call.
*/
-TEST_F(BroadcastRadioHalTest, SetConfigFlags) {
+TEST_P(BroadcastRadioHalTest, SetConfigFlags) {
ASSERT_TRUE(openSession());
auto get = [&](ConfigFlag flag) {
@@ -743,7 +741,7 @@
* - the complete list is fetched within timeout::programListScan;
* - stopProgramListUpdates does not crash.
*/
-TEST_F(BroadcastRadioHalTest, GetProgramList) {
+TEST_P(BroadcastRadioHalTest, GetProgramList) {
ASSERT_TRUE(openSession());
getProgramList();
@@ -757,7 +755,7 @@
* - the identifier matches the name;
* - there is only one identifier of that type.
*/
-TEST_F(BroadcastRadioHalTest, HdRadioStationNameId) {
+TEST_P(BroadcastRadioHalTest, HdRadioStationNameId) {
ASSERT_TRUE(openSession());
auto list = getProgramList();
@@ -785,7 +783,7 @@
* - if it succeeds, it returns a valid close handle (which is a nullptr otherwise);
* - closing handle does not crash.
*/
-TEST_F(BroadcastRadioHalTest, AnnouncementListenerRegistration) {
+TEST_P(BroadcastRadioHalTest, AnnouncementListenerRegistration) {
sp<AnnouncementListenerMock> listener = new AnnouncementListenerMock();
Result halResult = Result::UNKNOWN_ERROR;
@@ -811,6 +809,11 @@
closeHandle->close();
}
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, BroadcastRadioHalTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(IBroadcastRadio::descriptor)),
+ android::hardware::PrintInstanceNameToString);
+
} // namespace vts
} // namespace V2_0
} // namespace broadcastradio
@@ -818,14 +821,8 @@
} // namespace android
int main(int argc, char** argv) {
- using android::hardware::broadcastradio::V2_0::vts::gEnv;
- using android::hardware::broadcastradio::V2_0::IBroadcastRadio;
- using android::hardware::broadcastradio::vts::BroadcastRadioHidlEnvironment;
android::base::SetDefaultTag("BcRadio.vts");
android::base::SetMinimumLogSeverity(android::base::VERBOSE);
- gEnv = new BroadcastRadioHidlEnvironment<IBroadcastRadio>;
- ::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/pointer-utils.h b/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/pointer-utils.h
index 0b6f5eb..1d76008 100644
--- a/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/pointer-utils.h
+++ b/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/pointer-utils.h
@@ -19,6 +19,8 @@
#include <chrono>
#include <thread>
+using namespace std::chrono_literals;
+
namespace android {
namespace hardware {
namespace broadcastradio {
diff --git a/current.txt b/current.txt
index 57c6f69..a0864da 100644
--- a/current.txt
+++ b/current.txt
@@ -604,10 +604,10 @@
619fc9839ec6e369cfa9b28e3e9412e6885720ff8f9b5750c1b6ffb905120391 android.hardware.wifi.supplicant@1.3::ISupplicantStaIfaceCallback
c9273429fcf98d797d3bb07fdba6f1be95bf960f9255cde169fd1ca4db85f856 android.hardware.wifi.supplicant@1.3::ISupplicantStaNetwork
9b0a3ab6f4f74b971ed094426d8a443e29b512ff03e1ab50c07156396cdb2483 android.hardware.wifi.supplicant@1.3::types
-eaf870a7439838c66127a74e1896c4a2346979c116eb1931785ebb4d353230ae android.hardware.radio@1.5::types
-ae2fd16a80caff9cb6e3f91875c7f68f7ff76c75334056549d38496673eafe5b android.hardware.radio@1.5::IRadio
+0e3c23f1c815469fdcdc39bc33a486817771c7c6b6e5303f2f25569499fc6c69 android.hardware.radio@1.5::types
+52abfa4c94104189fa4b2bc3132fc7c9852b7428283463b020d1a3671a4f374c android.hardware.radio@1.5::IRadio
3afac66f21a33bc9c4b80481c7d5540038348651d9a7d8af64ea13610af138da android.hardware.radio@1.5::IRadioIndication
-e7268d32bedcf7d98324ffc808ec3dc45248d47ff4d04519d09e3c71767a7ad1 android.hardware.radio@1.5::IRadioResponse
+957ffbaf195aa046431ebe05a5906d215e80650e8e4933b394d6454b217ef3a9 android.hardware.radio@1.5::IRadioResponse
55f0a15642869ec98a55ea0a5ac049d3e1a6245ff7750deb6bcb7182057eee83 android.hardware.radio.config@1.3::types
b27ab0cd40b0b078cdcd024bfe1061c4c4c065f3519eeb9347fa359a3268a5ae android.hardware.radio.config@1.3::IRadioConfig
742360c775313438b0f82256eac62fb5bbc76a6ae6f388573f3aa142fb2c1eea android.hardware.radio.config@1.3::IRadioConfigIndication
diff --git a/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp b/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
index 5a75ae1..3702171 100644
--- a/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
+++ b/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
@@ -2590,13 +2590,6 @@
std::unique_lock<std::recursive_timed_mutex> lock(mStateMutex);
- // If the HWC2-side callback hasn't been registered yet, buffer this until
- // it is registered
- if (mCallbacks.count(Callback::Hotplug) == 0) {
- mPendingHotplugs.emplace_back(hwc1DisplayId, connected);
- return;
- }
-
hwc2_display_t displayId = UINT64_MAX;
if (mHwc1DisplayMap.count(hwc1DisplayId) == 0) {
if (connected == 0) {
@@ -2625,6 +2618,13 @@
mDisplays.erase(displayId);
}
+ // If the HWC2-side callback hasn't been registered yet, buffer this until
+ // it is registered
+ if (mCallbacks.count(Callback::Hotplug) == 0) {
+ mPendingHotplugs.emplace_back(hwc1DisplayId, connected);
+ return;
+ }
+
const auto& callbackInfo = mCallbacks[Callback::Hotplug];
// Call back without the state lock held
diff --git a/health/2.0/vts/functional/Android.bp b/health/2.0/vts/functional/Android.bp
index b090548..43571ef 100644
--- a/health/2.0/vts/functional/Android.bp
+++ b/health/2.0/vts/functional/Android.bp
@@ -23,5 +23,5 @@
"android.hardware.health@1.0",
"android.hardware.health@2.0",
],
- test_suites: ["general-tests"],
+ test_suites: ["general-tests", "vts-core"],
}
diff --git a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp
index 6e13a98..49891b7 100644
--- a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp
+++ b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp
@@ -20,17 +20,18 @@
#include <set>
#include <string>
-#include <VtsHalHidlTargetTestBase.h>
#include <android-base/logging.h>
#include <android/hardware/health/2.0/IHealth.h>
#include <android/hardware/health/2.0/types.h>
#include <gflags/gflags.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
+#include <log/log.h>
using ::testing::AssertionFailure;
using ::testing::AssertionResult;
using ::testing::AssertionSuccess;
-using ::testing::VtsHalHidlTargetTestBase;
-using ::testing::VtsHalHidlTargetTestEnvBase;
DEFINE_bool(force, false, "Force test healthd even when the default instance is present.");
@@ -74,30 +75,13 @@
using V1_0::BatteryStatus;
-// Test environment for graphics.composer
-class HealthHidlEnvironment : public VtsHalHidlTargetTestEnvBase {
- public:
- // get the test environment singleton
- static HealthHidlEnvironment* Instance() {
- static HealthHidlEnvironment* instance = new HealthHidlEnvironment;
- return instance;
- }
-
- virtual void registerTestServices() override { registerTestService<IHealth>(); }
-
- private:
- HealthHidlEnvironment() {}
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(HealthHidlEnvironment);
-};
-
-class HealthHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+class HealthHidlTest : public ::testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
- std::string serviceName = HealthHidlEnvironment::Instance()->getServiceName<IHealth>();
+ std::string serviceName = GetParam();
if (serviceName == "backup" && !FLAGS_force &&
- ::testing::VtsHalHidlTargetTestBase::getService<IHealth>() != nullptr) {
+ IHealth::getService() != nullptr) {
LOG(INFO) << "Skipping tests on healthd because the default instance is present. "
<< "Use --force if you really want to test healthd.";
GTEST_SKIP();
@@ -105,7 +89,7 @@
LOG(INFO) << "get service with name:" << serviceName;
ASSERT_FALSE(serviceName.empty());
- mHealth = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(serviceName);
+ mHealth = IHealth::getService(serviceName);
ASSERT_NE(mHealth, nullptr);
}
@@ -156,7 +140,7 @@
* Test whether callbacks work. Tested functions are IHealth::registerCallback,
* unregisterCallback, and update.
*/
-TEST_F(HealthHidlTest, Callbacks) {
+TEST_P(HealthHidlTest, Callbacks) {
SKIP_IF_SKIPPED();
using namespace std::chrono_literals;
sp<Callback> firstCallback = new Callback();
@@ -193,7 +177,7 @@
ASSERT_ALL_OK(mHealth->unregisterCallback(secondCallback));
}
-TEST_F(HealthHidlTest, UnregisterNonExistentCallback) {
+TEST_P(HealthHidlTest, UnregisterNonExistentCallback) {
SKIP_IF_SKIPPED();
sp<Callback> callback = new Callback();
auto ret = mHealth->unregisterCallback(callback);
@@ -278,7 +262,7 @@
/*
* Tests the values returned by getChargeCounter() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getChargeCounter) {
+TEST_P(HealthHidlTest, getChargeCounter) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getChargeCounter([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value > 0);
@@ -288,7 +272,7 @@
/*
* Tests the values returned by getCurrentNow() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getCurrentNow) {
+TEST_P(HealthHidlTest, getCurrentNow) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getCurrentNow([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN);
@@ -298,7 +282,7 @@
/*
* Tests the values returned by getCurrentAverage() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getCurrentAverage) {
+TEST_P(HealthHidlTest, getCurrentAverage) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getCurrentAverage([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN);
@@ -308,7 +292,7 @@
/*
* Tests the values returned by getCapacity() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getCapacity) {
+TEST_P(HealthHidlTest, getCapacity) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getCapacity([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), 0 <= value && value <= 100);
@@ -318,7 +302,7 @@
/*
* Tests the values returned by getEnergyCounter() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getEnergyCounter) {
+TEST_P(HealthHidlTest, getEnergyCounter) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getEnergyCounter([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT64_MIN);
@@ -328,7 +312,7 @@
/*
* Tests the values returned by getChargeStatus() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getChargeStatus) {
+TEST_P(HealthHidlTest, getChargeStatus) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getChargeStatus([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(
@@ -340,7 +324,7 @@
/*
* Tests the values returned by getStorageInfo() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getStorageInfo) {
+TEST_P(HealthHidlTest, getStorageInfo) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getStorageInfo([](auto result, auto& value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyStorageInfo(value));
@@ -350,7 +334,7 @@
/*
* Tests the values returned by getDiskStats() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getDiskStats) {
+TEST_P(HealthHidlTest, getDiskStats) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getDiskStats([](auto result, auto& value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), true);
@@ -360,25 +344,24 @@
/*
* Tests the values returned by getHealthInfo() from interface IHealth.
*/
-TEST_F(HealthHidlTest, getHealthInfo) {
+TEST_P(HealthHidlTest, getHealthInfo) {
SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getHealthInfo([](auto result, auto& value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyHealthInfo(value));
}));
}
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, HealthHidlTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(IHealth::descriptor)),
+ android::hardware::PrintInstanceNameToString);
} // namespace V2_0
} // namespace health
} // namespace hardware
} // namespace android
int main(int argc, char** argv) {
- using ::android::hardware::health::V2_0::HealthHidlEnvironment;
- ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
- HealthHidlEnvironment::Instance()->init(&argc, argv);
gflags::ParseCommandLineFlags(&argc, &argv, true /* remove flags */);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
- return status;
+ return RUN_ALL_TESTS();
}
diff --git a/radio/1.5/IRadio.hal b/radio/1.5/IRadio.hal
index a4eb93c..a3a3d90 100644
--- a/radio/1.5/IRadio.hal
+++ b/radio/1.5/IRadio.hal
@@ -16,8 +16,10 @@
package android.hardware.radio@1.5;
+import @1.2::DataRequestReason;
import @1.4::IRadio;
import @1.5::AccessNetwork;
+import @1.5::DataProfileInfo;
import @1.5::NetworkScanRequest;
import @1.5::RadioAccessSpecifier;
import @1.5::SignalThresholdInfo;
@@ -118,4 +120,78 @@
* 1.5 version of NetworkScanRequest
*/
oneway startNetworkScan_1_5(int32_t serial, NetworkScanRequest request);
+
+ /**
+ * Setup a packet data connection. If DataCallResponse.status returns DataCallFailCause:NONE,
+ * the data connection must be added to data calls and a unsolDataCallListChanged() must be
+ * sent. The call remains until removed by subsequent unsolDataCallIstChanged(). It may be
+ * lost due to many factors, including deactivateDataCall() being issued, the radio powered
+ * off, reception lost or even transient factors like congestion. This data call list is
+ * returned by getDataCallList() and dataCallListChanged().
+ *
+ * The Radio is expected to:
+ * - Create one data call context.
+ * - Create and configure a dedicated interface for the context.
+ * - The interface must be point to point.
+ * - The interface is configured with one or more addresses and is capable of sending and
+ * receiving packets. The prefix length of the addresses must be /32 for IPv4 and /128
+ * for IPv6.
+ * - Must not modify routing configuration related to this interface; routing management is
+ * exclusively within the purview of the Android OS.
+ * - Support simultaneous data call contexts up to DataRegStateResult.maxDataCalls specified
+ * in the response of getDataRegistrationState.
+ *
+ * @param serial Serial number of request.
+ * @param accessNetwork The access network to setup the data call. If the data connection cannot
+ * be established on the specified access network, the setup request must be failed.
+ * @param dataProfileInfo Data profile info.
+ * @param roamingAllowed Indicates whether or not data roaming is allowed by the user.
+ * @param reason The request reason. Must be DataRequestReason.NORMAL or
+ * DataRequestReason.HANDOVER.
+ * @param addresses If the reason is DataRequestReason.HANDOVER, this indicates the list of link
+ * addresses of the existing data connection. The format is IP address with optional "/"
+ * prefix length (The format is defined in RFC-4291 section 2.3). For example, "192.0.1.3",
+ * "192.0.1.11/16", or "2001:db8::1/64". Typically one IPv4 or one IPv6 or one of each. If
+ * the prefix length is absent, then the addresses are assumed to be point to point with
+ * IPv4 with prefix length 32 or IPv6 with prefix length 128. This parameter must be ignored
+ * unless reason is DataRequestReason.HANDOVER.
+ * @param dnses If the reason is DataRequestReason.HANDOVER, this indicates the list of DNS
+ * addresses of the existing data connection. The format is defined in RFC-4291 section
+ * 2.2. For example, "192.0.1.3" or "2001:db8::1". This parameter must be ignored unless
+ * reason is DataRequestReason.HANDOVER.
+ *
+ * Response function is IRadioResponse.setupDataCallResponse_1_5()
+ *
+ * Note this API is the same as the 1.4 version except using the
+ * 1.5 AccessNetwork and DataProfileInto as the input param.
+ */
+ oneway setupDataCall_1_5(int32_t serial, AccessNetwork accessNetwork,
+ DataProfileInfo dataProfileInfo, bool roamingAllowed,
+ DataRequestReason reason, vec<string> addresses, vec<string> dnses);
+
+ /**
+ * Set an apn to initial attach network
+ *
+ * @param serial Serial number of request.
+ * @param dataProfileInfo data profile containing APN settings
+ *
+ * Response callback is IRadioResponse.setInitialAttachApnResponse_1_5()
+ *
+ * Note this API is the same as the 1.4 version except using the 1.5 DataProfileInfo
+ * as the input param.
+ */
+ oneway setInitialAttachApn_1_5(int32_t serial, DataProfileInfo dataProfileInfo);
+
+ /**
+ * Send data profiles of the current carrier to the modem.
+ *
+ * @param serial Serial number of request.
+ * @param profiles Array of DataProfile to set.
+ *
+ * Response callback is IRadioResponse.setDataProfileResponse_1_5()
+ *
+ * Note this API is the same as the 1.4 version except using the 1.5 DataProfileInfo
+ * as the input param.
+ */
+ oneway setDataProfile_1_5(int32_t serial, vec<DataProfileInfo> profiles);
};
diff --git a/radio/1.5/IRadioResponse.hal b/radio/1.5/IRadioResponse.hal
index 505c595..11ec265 100644
--- a/radio/1.5/IRadioResponse.hal
+++ b/radio/1.5/IRadioResponse.hal
@@ -18,6 +18,7 @@
import @1.0::RadioResponseInfo;
import @1.4::IRadioResponse;
+import @1.4::SetupDataCallResult;
/**
* Interface declaring response functions to solicited radio requests.
@@ -80,4 +81,58 @@
* RadioError:INVALID_ARGUMENTS
*/
oneway startNetworkScanResponse_1_5(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param dcResponse SetupDataCallResult defined in types.hal
+ *
+ * Valid errors returned:
+ * RadioError:NONE must be returned on both success and failure of setup with the
+ * DataCallResponse.status containing the actual status
+ * For all other errors the DataCallResponse is ignored.
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:OP_NOT_ALLOWED_BEFORE_REG_TO_NW
+ * RadioError:OP_NOT_ALLOWED_DURING_VOICE_CALL
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_RESOURCES
+ * RadioError:SIM_ABSENT
+ */
+ oneway setupDataCallResponse_1_5(RadioResponseInfo info, SetupDataCallResult dcResponse);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:SUBSCRIPTION_NOT_AVAILABLE
+ * RadioError:NO_MEMORY
+ * RadioError:INTERNAL_ERR
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:NOT_PROVISIONED
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ */
+ oneway setInitialAttachApnResponse_1_5(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:SUBSCRIPTION_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:SIM_ABSENT
+ */
+ oneway setDataProfileResponse_1_5(RadioResponseInfo info);
};
diff --git a/radio/1.5/types.hal b/radio/1.5/types.hal
index 04a9bcf..5795f7b 100644
--- a/radio/1.5/types.hal
+++ b/radio/1.5/types.hal
@@ -24,6 +24,8 @@
import @1.1::UtranBands;
import @1.2::NetworkScanRequest;
import @1.4::AccessNetwork;
+import @1.4::ApnTypes;
+import @1.4::DataProfileInfo;
/**
* Defining signal strength type.
@@ -268,3 +270,22 @@
*/
vec<string> mccMncs;
};
+
+enum ApnTypes : @1.4::ApnTypes {
+ /**
+ * APN type for XCAP
+ * NOTE: Due to the addition of this new value, the value ALL defined in
+ * 1.0::ApnTypes is deprecated and should not be used.
+ */
+ XCAP = 1 << 11,
+};
+
+/**
+ * Extended from @1.4::DataProfileInfo to update ApnTypes to 1.5 version
+ */
+struct DataProfileInfo {
+ @1.4::DataProfileInfo base;
+
+ /** Supported APN types bitmap. See ApnTypes for the value of each bit. */
+ bitfield<ApnTypes> supportedApnTypesBitmap;
+};
diff --git a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
index 67438ae..1243bed 100644
--- a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
@@ -821,3 +821,140 @@
RadioError::REQUEST_NOT_SUPPORTED}));
}
}
+
+/*
+ * Test IRadio.setupDataCall_1_5() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_5, setupDataCall_1_5) {
+ serial = GetRandomSerialNumber();
+
+ ::android::hardware::radio::V1_5::AccessNetwork accessNetwork =
+ ::android::hardware::radio::V1_5::AccessNetwork::EUTRAN;
+
+ android::hardware::radio::V1_5::DataProfileInfo dataProfileInfo;
+ memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+ dataProfileInfo.base.profileId = DataProfileId::DEFAULT;
+ dataProfileInfo.base.apn = hidl_string("internet");
+ dataProfileInfo.base.protocol = PdpProtocolType::IP;
+ dataProfileInfo.base.roamingProtocol = PdpProtocolType::IP;
+ dataProfileInfo.base.authType = ApnAuthType::NO_PAP_NO_CHAP;
+ dataProfileInfo.base.user = hidl_string("username");
+ dataProfileInfo.base.password = hidl_string("password");
+ dataProfileInfo.base.type = DataProfileInfoType::THREE_GPP;
+ dataProfileInfo.base.maxConnsTime = 300;
+ dataProfileInfo.base.maxConns = 20;
+ dataProfileInfo.base.waitTime = 0;
+ dataProfileInfo.base.enabled = true;
+ dataProfileInfo.supportedApnTypesBitmap = 320;
+ dataProfileInfo.base.bearerBitmap = 161543;
+ dataProfileInfo.base.mtu = 0;
+ dataProfileInfo.base.preferred = true;
+ dataProfileInfo.base.persistent = false;
+
+ bool roamingAllowed = false;
+
+ ::android::hardware::radio::V1_2::DataRequestReason reason =
+ ::android::hardware::radio::V1_2::DataRequestReason::NORMAL;
+ std::vector<hidl_string> addresses = {""};
+ std::vector<hidl_string> dnses = {""};
+
+ Return<void> res = radio_v1_5->setupDataCall_1_5(serial, accessNetwork, dataProfileInfo,
+ roamingAllowed, reason, addresses, dnses);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
+
+ if (cardStatus.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ } else if (cardStatus.base.base.cardState == CardState::PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ }
+}
+
+TEST_F(RadioHidlTest_v1_5, setInitialAttachApn_1_5) {
+ serial = GetRandomSerialNumber();
+
+ // Create a dataProfileInfo
+ android::hardware::radio::V1_5::DataProfileInfo dataProfileInfo;
+ memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+ dataProfileInfo.base.profileId = DataProfileId::DEFAULT;
+ dataProfileInfo.base.apn = hidl_string("internet");
+ dataProfileInfo.base.protocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.base.roamingProtocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.base.authType = ApnAuthType::NO_PAP_NO_CHAP;
+ dataProfileInfo.base.user = hidl_string("username");
+ dataProfileInfo.base.password = hidl_string("password");
+ dataProfileInfo.base.type = DataProfileInfoType::THREE_GPP;
+ dataProfileInfo.base.maxConnsTime = 300;
+ dataProfileInfo.base.maxConns = 20;
+ dataProfileInfo.base.waitTime = 0;
+ dataProfileInfo.base.enabled = true;
+ dataProfileInfo.supportedApnTypesBitmap = 320;
+ dataProfileInfo.base.bearerBitmap = 161543;
+ dataProfileInfo.base.mtu = 0;
+ dataProfileInfo.base.preferred = true;
+ dataProfileInfo.base.persistent = false;
+
+ radio_v1_5->setInitialAttachApn_1_5(serial, dataProfileInfo);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
+
+ if (cardStatus.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE}));
+ } else if (cardStatus.base.base.cardState == CardState::PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
+ }
+}
+
+TEST_F(RadioHidlTest_v1_5, setDataProfile_1_5) {
+ serial = GetRandomSerialNumber();
+
+ // Create a dataProfileInfo
+ android::hardware::radio::V1_5::DataProfileInfo dataProfileInfo;
+ memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+ dataProfileInfo.base.profileId = DataProfileId::DEFAULT;
+ dataProfileInfo.base.apn = hidl_string("internet");
+ dataProfileInfo.base.protocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.base.roamingProtocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.base.authType = ApnAuthType::NO_PAP_NO_CHAP;
+ dataProfileInfo.base.user = hidl_string("username");
+ dataProfileInfo.base.password = hidl_string("password");
+ dataProfileInfo.base.type = DataProfileInfoType::THREE_GPP;
+ dataProfileInfo.base.maxConnsTime = 300;
+ dataProfileInfo.base.maxConns = 20;
+ dataProfileInfo.base.waitTime = 0;
+ dataProfileInfo.base.enabled = true;
+ dataProfileInfo.supportedApnTypesBitmap = 320;
+ dataProfileInfo.base.bearerBitmap = 161543;
+ dataProfileInfo.base.mtu = 0;
+ dataProfileInfo.base.preferred = true;
+ dataProfileInfo.base.persistent = true;
+
+ // Create a dataProfileInfoList
+ android::hardware::hidl_vec<android::hardware::radio::V1_5::DataProfileInfo>
+ dataProfileInfoList = {dataProfileInfo};
+
+ radio_v1_5->setDataProfile_1_5(serial, dataProfileInfoList);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
+
+ if (cardStatus.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE}));
+ } else if (cardStatus.base.base.cardState == CardState::PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
+ }
+}
diff --git a/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h b/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h
index 01bda69..f7526d9 100644
--- a/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h
+++ b/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h
@@ -541,6 +541,14 @@
Return<void> setSystemSelectionChannelsResponse_1_5(const RadioResponseInfo& info);
Return<void> startNetworkScanResponse_1_5(const RadioResponseInfo& info);
+
+ Return<void> setupDataCallResponse_1_5(
+ const RadioResponseInfo& info,
+ const android::hardware::radio::V1_4::SetupDataCallResult& dcResponse);
+
+ Return<void> setInitialAttachApnResponse_1_5(const RadioResponseInfo& info);
+
+ Return<void> setDataProfileResponse_1_5(const RadioResponseInfo& info);
};
/* Callback class for radio indication */
diff --git a/radio/1.5/vts/functional/radio_response.cpp b/radio/1.5/vts/functional/radio_response.cpp
index 5964c96..5dee191 100644
--- a/radio/1.5/vts/functional/radio_response.cpp
+++ b/radio/1.5/vts/functional/radio_response.cpp
@@ -928,3 +928,23 @@
parent_v1_5.notify(info.serial);
return Void();
}
+
+Return<void> RadioResponse_v1_5::setupDataCallResponse_1_5(
+ const RadioResponseInfo& info,
+ const android::hardware::radio::V1_4::SetupDataCallResult& /* dcResponse */) {
+ rspInfo = info;
+ parent_v1_5.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_5::setInitialAttachApnResponse_1_5(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_5.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_5::setDataProfileResponse_1_5(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_5.notify(info.serial);
+ return Void();
+}
diff --git a/renderscript/1.0/vts/functional/Android.bp b/renderscript/1.0/vts/functional/Android.bp
index 87e62f1..e3716e0 100644
--- a/renderscript/1.0/vts/functional/Android.bp
+++ b/renderscript/1.0/vts/functional/Android.bp
@@ -28,5 +28,5 @@
"android.hardware.renderscript@1.0",
"libnativewindow",
],
- test_suites: ["general-tests"],
+ test_suites: ["general-tests", "vts-core"],
}
diff --git a/renderscript/1.0/vts/functional/VtsCopyTests.cpp b/renderscript/1.0/vts/functional/VtsCopyTests.cpp
index f47253f..3040cbf 100644
--- a/renderscript/1.0/vts/functional/VtsCopyTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsCopyTests.cpp
@@ -27,7 +27,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, Simple1DCopyTest) {
+TEST_P(RenderscriptHidlTest, Simple1DCopyTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -63,7 +63,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, Simple2DCopyTest) {
+TEST_P(RenderscriptHidlTest, Simple2DCopyTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -100,7 +100,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, Simple3DCopyTest) {
+TEST_P(RenderscriptHidlTest, Simple3DCopyTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -137,7 +137,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, SimpleBitmapTest) {
+TEST_P(RenderscriptHidlTest, SimpleBitmapTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -177,7 +177,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, AllocationCopy2DRangeTest) {
+TEST_P(RenderscriptHidlTest, AllocationCopy2DRangeTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -229,7 +229,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, AllocationCopy3DRangeTest) {
+TEST_P(RenderscriptHidlTest, AllocationCopy3DRangeTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -282,7 +282,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, SimpleAdapterTest) {
+TEST_P(RenderscriptHidlTest, SimpleAdapterTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -339,7 +339,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, SimpleMipmapTest) {
+TEST_P(RenderscriptHidlTest, SimpleMipmapTest) {
// uint8_t
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -386,7 +386,7 @@
*
* Expect: dataIn & dataOut are the same.
*/
-TEST_F(RenderscriptHidlTest, SimpleCubemapTest) {
+TEST_P(RenderscriptHidlTest, SimpleCubemapTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -425,7 +425,7 @@
* typeCreate, allocationCreateTyped, allocationElementWrite,
* allocationElementRead
*/
-TEST_F(RenderscriptHidlTest, ComplexElementTest) {
+TEST_P(RenderscriptHidlTest, ComplexElementTest) {
Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element1);
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
index 0636cf9..5e5776c 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
@@ -18,8 +18,7 @@
// The main test class for RENDERSCRIPT HIDL HAL.
void RenderscriptHidlTest::SetUp() {
- device = ::testing::VtsHalHidlTargetTestBase::getService<IDevice>(
- RenderscriptHidlEnvironment::Instance()->getServiceName<IDevice>());
+ device = IDevice::getService(GetParam());
ASSERT_NE(nullptr, device.get());
uint32_t version = 0;
@@ -35,11 +34,7 @@
}
}
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(RenderscriptHidlEnvironment::Instance());
- ::testing::InitGoogleTest(&argc, argv);
- RenderscriptHidlEnvironment::Instance()->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
- return status;
-}
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RenderscriptHidlTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(IDevice::descriptor)),
+ android::hardware::PrintInstanceNameToString);
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
index e11ab92..b7dbed4 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
-#define VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
+#pragma once
#define LOG_TAG "renderscript_hidl_hal_test"
#include <android-base/logging.h>
@@ -24,9 +23,9 @@
#include <android/hardware/renderscript/1.0/IDevice.h>
#include <android/hardware/renderscript/1.0/types.h>
-#include <VtsHalHidlTargetTestBase.h>
-#include <VtsHalHidlTargetTestEnvBase.h>
#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
using ::android::hardware::renderscript::V1_0::Allocation;
using ::android::hardware::renderscript::V1_0::AllocationAdapter;
@@ -89,8 +88,8 @@
extern const int bitCodeLength;
// The main test class for RENDERSCRIPT HIDL HAL.
-class RenderscriptHidlTest : public ::testing::VtsHalHidlTargetTestBase {
-public:
+class RenderscriptHidlTest : public ::testing::TestWithParam<std::string> {
+ public:
virtual void SetUp() override;
virtual void TearDown() override;
@@ -99,17 +98,3 @@
private:
sp<IDevice> device;
};
-
-// Test environment for RENDERSCRIPT HIDL HAL.
-class RenderscriptHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
- // get the test environment singleton
- static RenderscriptHidlEnvironment* Instance() {
- static RenderscriptHidlEnvironment* instance = new RenderscriptHidlEnvironment;
- return instance;
- }
-
- virtual void registerTestServices() override { registerTestService<IDevice>(); }
-};
-
-#endif // VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
diff --git a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
index 278dbf3..c66ddea 100644
--- a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
@@ -25,14 +25,14 @@
*
* Calls: getService<IDevice>, contextCreate, contextDestroy
*/
-TEST_F(RenderscriptHidlTest, ContextCreateAndDestroy) {}
+TEST_P(RenderscriptHidlTest, ContextCreateAndDestroy) {}
/*
* Create an Element and verify the return value is valid.
*
* Calls: elementCreate
*/
-TEST_F(RenderscriptHidlTest, ElementCreate) {
+TEST_P(RenderscriptHidlTest, ElementCreate) {
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
EXPECT_NE(Element(0), element);
}
@@ -43,7 +43,7 @@
*
* Calls: elementCreate, typeCreate, allocationCreateTyped, allocationGetType
*/
-TEST_F(RenderscriptHidlTest, ElementTypeAllocationCreate) {
+TEST_P(RenderscriptHidlTest, ElementTypeAllocationCreate) {
// Element create test
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -71,7 +71,7 @@
* Calls: elementCreate, typeCreate, elementGetNativeMetadata,
* typeGetNativeMetadata
*/
-TEST_F(RenderscriptHidlTest, MetadataTest) {
+TEST_P(RenderscriptHidlTest, MetadataTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -107,7 +107,7 @@
* Calls: elementCreate, typeCreate, allocationCreateTyped,
* allocationGetPointer, allocationResize1D
*/
-TEST_F(RenderscriptHidlTest, ResizeTest) {
+TEST_P(RenderscriptHidlTest, ResizeTest) {
// float1
Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
ASSERT_NE(Element(0), element);
@@ -145,7 +145,7 @@
* allocationGetNativeWindow, allocationSetNativeWindow, allocationIoSend,
* allocationIoReceive, allocation2DRead
*/
-TEST_F(RenderscriptHidlTest, NativeWindowIoTest) {
+TEST_P(RenderscriptHidlTest, NativeWindowIoTest) {
// uint8x4
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4);
ASSERT_NE(Element(0), element);
@@ -198,7 +198,7 @@
* allocation2DWrite, allocation2DRead, allocationIoSend,
* allocationIoReceive
*/
-TEST_F(RenderscriptHidlTest, BufferQueueTest) {
+TEST_P(RenderscriptHidlTest, BufferQueueTest) {
// uint8x4
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4);
ASSERT_NE(Element(0), element);
@@ -269,7 +269,7 @@
* Calls: contextInitToClient, contextSendMessage, contextPeekMessage,
* contextGetMessage, contextDeinitToClient, contextLog
*/
-TEST_F(RenderscriptHidlTest, ContextMessageTest) {
+TEST_P(RenderscriptHidlTest, ContextMessageTest) {
context->contextInitToClient();
const char * message = "correct";
@@ -299,7 +299,7 @@
* Calls: contextSetPriority, contextSetCacheDir, elementCreate, assignName,
* contextFinish, getName, objDestroy, samplerCreate
*/
-TEST_F(RenderscriptHidlTest, MiscellaneousTests) {
+TEST_P(RenderscriptHidlTest, MiscellaneousTests) {
context->contextSetPriority(ThreadPriorities::NORMAL);
context->contextSetCacheDir("/data/local/tmp/temp/");
diff --git a/renderscript/1.0/vts/functional/VtsScriptTests.cpp b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
index 8d24cfa..9607267 100644
--- a/renderscript/1.0/vts/functional/VtsScriptTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
@@ -22,7 +22,7 @@
*
* Calls: elementCreate, scriptIntrinsicCreate, scriptSetTimeZone
*/
-TEST_F(RenderscriptHidlTest, IntrinsicTest) {
+TEST_P(RenderscriptHidlTest, IntrinsicTest) {
// uint8
Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
EXPECT_NE(Element(0), element);
@@ -41,7 +41,7 @@
* scriptSetVarF, scriptSetVarD, elementCreate, typeCreate,
* allocationCreateTyped, scriptSetVarObj, scriptSetVarV, scriptSetVarVE
*/
-TEST_F(RenderscriptHidlTest, ScriptVarTest) {
+TEST_P(RenderscriptHidlTest, ScriptVarTest) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
@@ -132,7 +132,7 @@
*
* Calls: scriptCCreate, scriptInvoke, scriptGetVarV, scriptInvokeV
*/
-TEST_F(RenderscriptHidlTest, ScriptInvokeTest) {
+TEST_P(RenderscriptHidlTest, ScriptInvokeTest) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
@@ -191,7 +191,7 @@
* Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
* allocation1DWrite, scriptForEach, allocationRead
*/
-TEST_F(RenderscriptHidlTest, ScriptForEachTest) {
+TEST_P(RenderscriptHidlTest, ScriptForEachTest) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
@@ -237,7 +237,7 @@
* Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
* allocation1DWrite, scriptReduce, contextFinish, allocationRead
*/
-TEST_F(RenderscriptHidlTest, ScriptReduceTest) {
+TEST_P(RenderscriptHidlTest, ScriptReduceTest) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
@@ -288,7 +288,7 @@
* allocation1DWrite, scriptBindAllocation, scriptSetVarV, scriptBindAllocation,
* allocationRead, scriptInvokeV, allocationRead
*/
-TEST_F(RenderscriptHidlTest, ScriptBindTest) {
+TEST_P(RenderscriptHidlTest, ScriptBindTest) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
@@ -333,7 +333,7 @@
* scriptGroupCreate, scriptGroupSetInput, scriptGroupSetOutput,
* scriptGroupExecute, contextFinish, allocation2DRead
*/
-TEST_F(RenderscriptHidlTest, ScriptGroupTest) {
+TEST_P(RenderscriptHidlTest, ScriptGroupTest) {
std::vector<uint8_t> dataIn(256 * 256 * 4, 128), dataOut(256 * 256 * 4, 0),
zeros(256 * 256 * 4, 0);
hidl_vec<uint8_t> _dataIn, _dataOut;
@@ -418,7 +418,7 @@
* invokeClosureCreate, closureCreate, closureSetGlobal, scriptGroup2Create,
* scriptGroupExecute, allocationRead
*/
-TEST_F(RenderscriptHidlTest, ScriptGroup2Test) {
+TEST_P(RenderscriptHidlTest, ScriptGroup2Test) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
@@ -495,7 +495,7 @@
* allocation1DWrite, scriptKernelIDCreate, closureCreate, closureSetArg,
* scriptGroup2Create, scriptGroupExecute, allocationRead
*/
-TEST_F(RenderscriptHidlTest, ScriptGroup2KernelTest) {
+TEST_P(RenderscriptHidlTest, ScriptGroup2KernelTest) {
hidl_vec<uint8_t> bitcode;
bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
diff --git a/tetheroffload/control/1.0/vts/functional/Android.bp b/tetheroffload/control/1.0/vts/functional/Android.bp
index e8e1414..4af59b6 100644
--- a/tetheroffload/control/1.0/vts/functional/Android.bp
+++ b/tetheroffload/control/1.0/vts/functional/Android.bp
@@ -20,5 +20,5 @@
"android.hardware.tetheroffload.config@1.0",
"android.hardware.tetheroffload.control@1.0",
],
- test_suites: ["general-tests"],
+ test_suites: ["general-tests", "vts-core"],
}
diff --git a/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp b/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
index 03b6406..b422b2f 100644
--- a/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
+++ b/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
@@ -17,15 +17,17 @@
#define LOG_TAG "VtsOffloadControlV1_0TargetTest"
#include <VtsHalHidlTargetCallbackBase.h>
-#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 <android/hardware/tetheroffload/control/1.0/IOffloadControl.h>
#include <android/hardware/tetheroffload/control/1.0/types.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
#include <linux/netfilter/nfnetlink.h>
#include <linux/netlink.h>
+#include <log/log.h>
#include <net/if.h>
#include <sys/socket.h>
#include <unistd.h>
@@ -110,24 +112,8 @@
NatTimeoutUpdate last_params;
};
-// Test environment for OffloadControl HIDL HAL.
-class OffloadControlHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
- // get the test environment singleton
- static OffloadControlHidlEnvironment* Instance() {
- static OffloadControlHidlEnvironment* instance = new OffloadControlHidlEnvironment;
- return instance;
- }
-
- virtual void registerTestServices() override {
- registerTestService<IOffloadConfig>();
- registerTestService<IOffloadControl>();
- }
- private:
- OffloadControlHidlEnvironment() {}
-};
-
-class OffloadControlHidlTestBase : public testing::VtsHalHidlTargetTestBase {
+class OffloadControlHidlTestBase
+ : public testing::TestWithParam<std::tuple<std::string, std::string>> {
public:
virtual void SetUp() override {
setupConfigHal();
@@ -144,8 +130,7 @@
// The IOffloadConfig HAL is tested more thoroughly elsewhere. He we just
// setup everything correctly and verify basic readiness.
void setupConfigHal() {
- config = testing::VtsHalHidlTargetTestBase::getService<IOffloadConfig>(
- OffloadControlHidlEnvironment::Instance()->getServiceName<IOffloadConfig>());
+ config = IOffloadConfig::getService(std::get<0>(GetParam()));
ASSERT_NE(nullptr, config.get()) << "Could not get HIDL instance";
unique_fd fd1(conntrackSocket(NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY));
@@ -173,8 +158,7 @@
}
void prepareControlHal() {
- control = testing::VtsHalHidlTargetTestBase::getService<IOffloadControl>(
- OffloadControlHidlEnvironment::Instance()->getServiceName<IOffloadControl>());
+ control = IOffloadControl::getService(std::get<1>(GetParam()));
ASSERT_NE(nullptr, control.get()) << "Could not get HIDL instance";
control_cb = new TetheringOffloadCallback();
@@ -240,7 +224,7 @@
};
// Call initOffload() multiple times. Check that non-first initOffload() calls return false.
-TEST_F(OffloadControlHidlTestBase, AdditionalInitsWithoutStopReturnFalse) {
+TEST_P(OffloadControlHidlTestBase, AdditionalInitsWithoutStopReturnFalse) {
initOffload(true);
initOffload(false);
initOffload(false);
@@ -248,7 +232,7 @@
}
// Check that calling stopOffload() without first having called initOffload() returns false.
-TEST_F(OffloadControlHidlTestBase, MultipleStopsWithoutInitReturnFalse) {
+TEST_P(OffloadControlHidlTestBase, MultipleStopsWithoutInitReturnFalse) {
stopOffload(ExpectBoolean::False);
stopOffload(ExpectBoolean::False);
stopOffload(ExpectBoolean::False);
@@ -267,7 +251,7 @@
}
// Check that calling stopOffload() after a complete init/stop cycle returns false.
-TEST_F(OffloadControlHidlTestBase, AdditionalStopsWithInitReturnFalse) {
+TEST_P(OffloadControlHidlTestBase, AdditionalStopsWithInitReturnFalse) {
initOffload(true);
// Call setUpstreamParameters() so that "offload" can be reasonably said
// to be both requested and operational.
@@ -289,7 +273,7 @@
}
// Check that calling setLocalPrefixes() without first having called initOffload() returns false.
-TEST_F(OffloadControlHidlTestBase, SetLocalPrefixesWithoutInitReturnsFalse) {
+TEST_P(OffloadControlHidlTestBase, SetLocalPrefixesWithoutInitReturnsFalse) {
const vector<hidl_string> prefixes{hidl_string("2001:db8::/64")};
const Return<void> ret = control->setLocalPrefixes(prefixes, ASSERT_FALSE_CALLBACK);
EXPECT_TRUE(ret.isOk());
@@ -297,14 +281,14 @@
// Check that calling getForwardedStats() without first having called initOffload()
// returns zero bytes statistics.
-TEST_F(OffloadControlHidlTestBase, GetForwardedStatsWithoutInitReturnsZeroValues) {
+TEST_P(OffloadControlHidlTestBase, GetForwardedStatsWithoutInitReturnsZeroValues) {
const hidl_string upstream(TEST_IFACE);
const Return<void> ret = control->getForwardedStats(upstream, ASSERT_ZERO_BYTES_CALLBACK);
EXPECT_TRUE(ret.isOk());
}
// Check that calling setDataLimit() without first having called initOffload() returns false.
-TEST_F(OffloadControlHidlTestBase, SetDataLimitWithoutInitReturnsFalse) {
+TEST_P(OffloadControlHidlTestBase, SetDataLimitWithoutInitReturnsFalse) {
const hidl_string upstream(TEST_IFACE);
const uint64_t limit = 5000ULL;
const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_FALSE_CALLBACK);
@@ -313,7 +297,7 @@
// Check that calling setUpstreamParameters() without first having called initOffload()
// returns false.
-TEST_F(OffloadControlHidlTestBase, SetUpstreamParametersWithoutInitReturnsFalse) {
+TEST_P(OffloadControlHidlTestBase, SetUpstreamParametersWithoutInitReturnsFalse) {
const hidl_string iface(TEST_IFACE);
const hidl_string v4Addr("192.0.2.0/24");
const hidl_string v4Gw("192.0.2.1");
@@ -325,7 +309,7 @@
// Check that calling addDownstream() with an IPv4 prefix without first having called
// initOffload() returns false.
-TEST_F(OffloadControlHidlTestBase, AddIPv4DownstreamWithoutInitReturnsFalse) {
+TEST_P(OffloadControlHidlTestBase, AddIPv4DownstreamWithoutInitReturnsFalse) {
const hidl_string iface(TEST_IFACE);
const hidl_string prefix("192.0.2.0/24");
const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_FALSE_CALLBACK);
@@ -334,7 +318,7 @@
// Check that calling addDownstream() with an IPv6 prefix without first having called
// initOffload() returns false.
-TEST_F(OffloadControlHidlTestBase, AddIPv6DownstreamWithoutInitReturnsFalse) {
+TEST_P(OffloadControlHidlTestBase, AddIPv6DownstreamWithoutInitReturnsFalse) {
const hidl_string iface(TEST_IFACE);
const hidl_string prefix("2001:db8::/64");
const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_FALSE_CALLBACK);
@@ -343,7 +327,7 @@
// Check that calling removeDownstream() with an IPv4 prefix without first having called
// initOffload() returns false.
-TEST_F(OffloadControlHidlTestBase, RemoveIPv4DownstreamWithoutInitReturnsFalse) {
+TEST_P(OffloadControlHidlTestBase, RemoveIPv4DownstreamWithoutInitReturnsFalse) {
const hidl_string iface(TEST_IFACE);
const hidl_string prefix("192.0.2.0/24");
const Return<void> ret = control->removeDownstream(iface, prefix, ASSERT_FALSE_CALLBACK);
@@ -352,7 +336,7 @@
// Check that calling removeDownstream() with an IPv6 prefix without first having called
// initOffload() returns false.
-TEST_F(OffloadControlHidlTestBase, RemoveIPv6DownstreamWithoutInitReturnsFalse) {
+TEST_P(OffloadControlHidlTestBase, RemoveIPv6DownstreamWithoutInitReturnsFalse) {
const hidl_string iface(TEST_IFACE);
const hidl_string prefix("2001:db8::/64");
const Return<void> ret = control->removeDownstream(iface, prefix, ASSERT_FALSE_CALLBACK);
@@ -379,21 +363,21 @@
*/
// Test setLocalPrefixes() accepts an IPv4 address.
-TEST_F(OffloadControlHidlTest, SetLocalPrefixesIPv4AddressOk) {
+TEST_P(OffloadControlHidlTest, SetLocalPrefixesIPv4AddressOk) {
const vector<hidl_string> prefixes{hidl_string("192.0.2.1")};
const Return<void> ret = control->setLocalPrefixes(prefixes, ASSERT_TRUE_CALLBACK);
EXPECT_TRUE(ret.isOk());
}
// Test setLocalPrefixes() accepts an IPv6 address.
-TEST_F(OffloadControlHidlTest, SetLocalPrefixesIPv6AddressOk) {
+TEST_P(OffloadControlHidlTest, SetLocalPrefixesIPv6AddressOk) {
const vector<hidl_string> prefixes{hidl_string("fe80::1")};
const Return<void> ret = control->setLocalPrefixes(prefixes, ASSERT_TRUE_CALLBACK);
EXPECT_TRUE(ret.isOk());
}
// Test setLocalPrefixes() accepts both IPv4 and IPv6 prefixes.
-TEST_F(OffloadControlHidlTest, SetLocalPrefixesIPv4v6PrefixesOk) {
+TEST_P(OffloadControlHidlTest, SetLocalPrefixesIPv4v6PrefixesOk) {
const vector<hidl_string> prefixes{hidl_string("192.0.2.0/24"), hidl_string("fe80::/64")};
const Return<void> ret = control->setLocalPrefixes(prefixes, ASSERT_TRUE_CALLBACK);
EXPECT_TRUE(ret.isOk());
@@ -402,14 +386,14 @@
// Test that setLocalPrefixes() fails given empty input. There is always
// a non-empty set of local prefixes; when all networking interfaces are down
// we still apply {127.0.0.0/8, ::1/128, fe80::/64} here.
-TEST_F(OffloadControlHidlTest, SetLocalPrefixesEmptyFails) {
+TEST_P(OffloadControlHidlTest, SetLocalPrefixesEmptyFails) {
const vector<hidl_string> prefixes{};
const Return<void> ret = control->setLocalPrefixes(prefixes, ASSERT_FALSE_CALLBACK);
EXPECT_TRUE(ret.isOk());
}
// Test setLocalPrefixes() fails on incorrectly formed input strings.
-TEST_F(OffloadControlHidlTest, SetLocalPrefixesInvalidFails) {
+TEST_P(OffloadControlHidlTest, SetLocalPrefixesInvalidFails) {
const vector<hidl_string> prefixes{hidl_string("192.0.2.0/24"), hidl_string("invalid")};
const Return<void> ret = control->setLocalPrefixes(prefixes, ASSERT_FALSE_CALLBACK);
EXPECT_TRUE(ret.isOk());
@@ -420,7 +404,7 @@
*/
// Test that getForwardedStats() for a non-existent upstream yields zero bytes statistics.
-TEST_F(OffloadControlHidlTest, GetForwardedStatsInvalidUpstreamIface) {
+TEST_P(OffloadControlHidlTest, GetForwardedStatsInvalidUpstreamIface) {
const hidl_string upstream("invalid");
const Return<void> ret = control->getForwardedStats(upstream, ASSERT_ZERO_BYTES_CALLBACK);
EXPECT_TRUE(ret.isOk());
@@ -428,7 +412,7 @@
// TEST_IFACE is presumed to exist on the device and be up. No packets
// are ever actually caused to be forwarded.
-TEST_F(OffloadControlHidlTest, GetForwardedStatsDummyIface) {
+TEST_P(OffloadControlHidlTest, GetForwardedStatsDummyIface) {
const hidl_string upstream(TEST_IFACE);
const Return<void> ret = control->getForwardedStats(upstream, ASSERT_ZERO_BYTES_CALLBACK);
EXPECT_TRUE(ret.isOk());
@@ -439,7 +423,7 @@
*/
// Test that setDataLimit() for an empty interface name fails.
-TEST_F(OffloadControlHidlTest, SetDataLimitEmptyUpstreamIfaceFails) {
+TEST_P(OffloadControlHidlTest, SetDataLimitEmptyUpstreamIfaceFails) {
const hidl_string upstream("");
const uint64_t limit = 5000ULL;
const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_FALSE_CALLBACK);
@@ -448,7 +432,7 @@
// TEST_IFACE is presumed to exist on the device and be up. No packets
// are ever actually caused to be forwarded.
-TEST_F(OffloadControlHidlTest, SetDataLimitNonZeroOk) {
+TEST_P(OffloadControlHidlTest, SetDataLimitNonZeroOk) {
const hidl_string upstream(TEST_IFACE);
const uint64_t limit = 5000ULL;
const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_TRUE_CALLBACK);
@@ -457,7 +441,7 @@
// TEST_IFACE is presumed to exist on the device and be up. No packets
// are ever actually caused to be forwarded.
-TEST_F(OffloadControlHidlTest, SetDataLimitZeroOk) {
+TEST_P(OffloadControlHidlTest, SetDataLimitZeroOk) {
const hidl_string upstream(TEST_IFACE);
const uint64_t limit = 0ULL;
const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_TRUE_CALLBACK);
@@ -470,7 +454,7 @@
// TEST_IFACE is presumed to exist on the device and be up. No packets
// are ever actually caused to be forwarded.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv6OnlyOk) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersIPv6OnlyOk) {
const hidl_string iface(TEST_IFACE);
const hidl_string v4Addr("");
const hidl_string v4Gw("");
@@ -482,7 +466,7 @@
// TEST_IFACE is presumed to exist on the device and be up. No packets
// are ever actually caused to be forwarded.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersAlternateIPv6OnlyOk) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersAlternateIPv6OnlyOk) {
const hidl_string iface(TEST_IFACE);
const hidl_string v4Addr;
const hidl_string v4Gw;
@@ -494,7 +478,7 @@
// TEST_IFACE is presumed to exist on the device and be up. No packets
// are ever actually caused to be forwarded.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv4OnlyOk) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersIPv4OnlyOk) {
const hidl_string iface(TEST_IFACE);
const hidl_string v4Addr("192.0.2.2");
const hidl_string v4Gw("192.0.2.1");
@@ -506,7 +490,7 @@
// TEST_IFACE is presumed to exist on the device and be up. No packets
// are ever actually caused to be forwarded.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv4v6Ok) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersIPv4v6Ok) {
const hidl_string iface(TEST_IFACE);
const hidl_string v4Addr("192.0.2.2");
const hidl_string v4Gw("192.0.2.1");
@@ -517,7 +501,7 @@
}
// Test that setUpstreamParameters() fails when all parameters are empty.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersEmptyFails) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersEmptyFails) {
const hidl_string iface("");
const hidl_string v4Addr("");
const hidl_string v4Gw("");
@@ -528,7 +512,7 @@
}
// Test that setUpstreamParameters() fails when given empty or non-existent interface names.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersBogusIfaceFails) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersBogusIfaceFails) {
const hidl_string v4Addr("192.0.2.2");
const hidl_string v4Gw("192.0.2.1");
const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")};
@@ -542,7 +526,7 @@
}
// Test that setUpstreamParameters() fails when given unparseable IPv4 addresses.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4AddrFails) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4AddrFails) {
const hidl_string iface(TEST_IFACE);
const hidl_string v4Gw("192.0.2.1");
const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")};
@@ -556,7 +540,7 @@
}
// Test that setUpstreamParameters() fails when given unparseable IPv4 gateways.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4GatewayFails) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4GatewayFails) {
const hidl_string iface(TEST_IFACE);
const hidl_string v4Addr("192.0.2.2");
const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")};
@@ -570,7 +554,7 @@
}
// Test that setUpstreamParameters() fails when given unparseable IPv6 gateways.
-TEST_F(OffloadControlHidlTest, SetUpstreamParametersBadIPv6GatewaysFail) {
+TEST_P(OffloadControlHidlTest, SetUpstreamParametersBadIPv6GatewaysFail) {
const hidl_string iface(TEST_IFACE);
const hidl_string v4Addr("192.0.2.2");
const hidl_string v4Gw("192.0.2.1");
@@ -588,7 +572,7 @@
*/
// Test addDownstream() works given an IPv4 prefix.
-TEST_F(OffloadControlHidlTest, AddDownstreamIPv4) {
+TEST_P(OffloadControlHidlTest, AddDownstreamIPv4) {
const hidl_string iface("dummy0");
const hidl_string prefix("192.0.2.0/24");
const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_TRUE_CALLBACK);
@@ -596,7 +580,7 @@
}
// Test addDownstream() works given an IPv6 prefix.
-TEST_F(OffloadControlHidlTest, AddDownstreamIPv6) {
+TEST_P(OffloadControlHidlTest, AddDownstreamIPv6) {
const hidl_string iface("dummy0");
const hidl_string prefix("2001:db8::/64");
const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_TRUE_CALLBACK);
@@ -604,7 +588,7 @@
}
// Test addDownstream() fails given all empty parameters.
-TEST_F(OffloadControlHidlTest, AddDownstreamEmptyFails) {
+TEST_P(OffloadControlHidlTest, AddDownstreamEmptyFails) {
const hidl_string iface("");
const hidl_string prefix("");
const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_FALSE_CALLBACK);
@@ -612,7 +596,7 @@
}
// Test addDownstream() fails given empty or non-existent interface names.
-TEST_F(OffloadControlHidlTest, AddDownstreamInvalidIfaceFails) {
+TEST_P(OffloadControlHidlTest, AddDownstreamInvalidIfaceFails) {
const hidl_string prefix("192.0.2.0/24");
for (const auto& bogus : {"", "invalid"}) {
SCOPED_TRACE(StringPrintf("iface='%s'", bogus));
@@ -623,7 +607,7 @@
}
// Test addDownstream() fails given unparseable prefix arguments.
-TEST_F(OffloadControlHidlTest, AddDownstreamBogusPrefixFails) {
+TEST_P(OffloadControlHidlTest, AddDownstreamBogusPrefixFails) {
const hidl_string iface("dummy0");
for (const auto& bogus : {"", "192.0.2/24", "2001:db8/64"}) {
SCOPED_TRACE(StringPrintf("prefix='%s'", bogus));
@@ -638,7 +622,7 @@
*/
// Test removeDownstream() works given an IPv4 prefix.
-TEST_F(OffloadControlHidlTest, RemoveDownstreamIPv4) {
+TEST_P(OffloadControlHidlTest, RemoveDownstreamIPv4) {
const hidl_string iface("dummy0");
const hidl_string prefix("192.0.2.0/24");
// First add the downstream, otherwise removeDownstream logic can reasonably
@@ -650,7 +634,7 @@
}
// Test removeDownstream() works given an IPv6 prefix.
-TEST_F(OffloadControlHidlTest, RemoveDownstreamIPv6) {
+TEST_P(OffloadControlHidlTest, RemoveDownstreamIPv6) {
const hidl_string iface("dummy0");
const hidl_string prefix("2001:db8::/64");
// First add the downstream, otherwise removeDownstream logic can reasonably
@@ -662,7 +646,7 @@
}
// Test removeDownstream() fails given all empty parameters.
-TEST_F(OffloadControlHidlTest, RemoveDownstreamEmptyFails) {
+TEST_P(OffloadControlHidlTest, RemoveDownstreamEmptyFails) {
const hidl_string iface("");
const hidl_string prefix("");
const Return<void> ret = control->removeDownstream(iface, prefix, ASSERT_FALSE_CALLBACK);
@@ -670,7 +654,7 @@
}
// Test removeDownstream() fails given empty or non-existent interface names.
-TEST_F(OffloadControlHidlTest, RemoveDownstreamBogusIfaceFails) {
+TEST_P(OffloadControlHidlTest, RemoveDownstreamBogusIfaceFails) {
const hidl_string prefix("192.0.2.0/24");
for (const auto& bogus : {"", "invalid"}) {
SCOPED_TRACE(StringPrintf("iface='%s'", bogus));
@@ -681,7 +665,7 @@
}
// Test removeDownstream() fails given unparseable prefix arguments.
-TEST_F(OffloadControlHidlTest, RemoveDownstreamBogusPrefixFails) {
+TEST_P(OffloadControlHidlTest, RemoveDownstreamBogusPrefixFails) {
const hidl_string iface("dummy0");
for (const auto& bogus : {"", "192.0.2/24", "2001:db8/64"}) {
SCOPED_TRACE(StringPrintf("prefix='%s'", bogus));
@@ -691,11 +675,21 @@
}
}
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(OffloadControlHidlEnvironment::Instance());
- ::testing::InitGoogleTest(&argc, argv);
- OffloadControlHidlEnvironment::Instance()->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- ALOGE("Test result with status=%d", status);
- return status;
-}
+INSTANTIATE_TEST_CASE_P(
+ PerInstance, OffloadControlHidlTestBase,
+ testing::Combine(
+ testing::ValuesIn(
+ android::hardware::getAllHalInstanceNames(IOffloadConfig::descriptor)),
+ testing::ValuesIn(
+ android::hardware::getAllHalInstanceNames(IOffloadControl::descriptor))),
+ android::hardware::PrintInstanceTupleNameToString<>);
+
+INSTANTIATE_TEST_CASE_P(
+ PerInstance, OffloadControlHidlTest,
+ testing::Combine(
+ testing::ValuesIn(
+ android::hardware::getAllHalInstanceNames(IOffloadConfig::descriptor)),
+ testing::ValuesIn(
+ android::hardware::getAllHalInstanceNames(IOffloadControl::descriptor))),
+ android::hardware::PrintInstanceTupleNameToString<>);
+
diff --git a/usb/1.1/vts/functional/Android.bp b/usb/1.1/vts/functional/Android.bp
index 1f0972f..32c470b 100644
--- a/usb/1.1/vts/functional/Android.bp
+++ b/usb/1.1/vts/functional/Android.bp
@@ -22,6 +22,6 @@
"android.hardware.usb@1.0",
"android.hardware.usb@1.1",
],
- test_suites: ["general-tests"],
+ test_suites: ["general-tests", "vts-core"],
}
diff --git a/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp b/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp
index caf9c69..d4b2ffd 100644
--- a/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp
+++ b/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp
@@ -23,8 +23,9 @@
#include <android/hardware/usb/1.1/types.h>
#include <VtsHalHidlTargetCallbackBase.h>
-#include <VtsHalHidlTargetTestBase.h>
-#include <VtsHalHidlTargetTestEnvBase.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
#include <log/log.h>
#include <stdlib.h>
#include <chrono>
@@ -114,25 +115,12 @@
};
};
-// Test environment for Usb HIDL HAL.
-class UsbHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
- // get the test environment singleton
- static UsbHidlEnvironment* Instance() {
- static UsbHidlEnvironment* instance = new UsbHidlEnvironment;
- return instance;
- }
-
- virtual void registerTestServices() override { registerTestService<IUsb>(); }
-};
-
// The main test class for the USB hidl HAL
-class UsbHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+class UsbHidlTest : public ::testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
ALOGI(__FUNCTION__);
- usb = ::testing::VtsHalHidlTargetTestBase::getService<IUsb>(
- UsbHidlEnvironment::Instance()->getServiceName<IUsb>());
+ usb = IUsb::getService(GetParam());
ASSERT_NE(usb, nullptr);
usb_cb_2 = new UsbCallback(2);
@@ -158,7 +146,7 @@
* Callback oject is created and registered.
* Check to see if the hidl transaction succeeded.
*/
-TEST_F(UsbHidlTest, setCallback) {
+TEST_P(UsbHidlTest, setCallback) {
usb_cb_1 = new UsbCallback(1);
ASSERT_NE(usb_cb_1, nullptr);
Return<void> ret = usb->setCallback(usb_cb_1);
@@ -171,7 +159,7 @@
* HAL service should call notifyPortStatusChange_1_1
* instead of notifyPortStatusChange of V1_0 interface
*/
-TEST_F(UsbHidlTest, queryPortStatus) {
+TEST_P(UsbHidlTest, queryPortStatus) {
Return<void> ret = usb->queryPortStatus();
ASSERT_TRUE(ret.isOk());
auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_1);
@@ -181,12 +169,7 @@
EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status.supportedModes);
EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
}
-
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(UsbHidlEnvironment::Instance());
- ::testing::InitGoogleTest(&argc, argv);
- UsbHidlEnvironment::Instance()->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- ALOGI("Test result = %d", status);
- return status;
-}
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, UsbHidlTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(IUsb::descriptor)),
+ android::hardware::PrintInstanceNameToString);