Merge "Convert evs hal test to use VtsHalHidlTargetTestEnvBase"
diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
index 6c9aa18..b9f505d 100644
--- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
+++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
@@ -25,6 +25,7 @@
#include <VtsHalHidlTargetCallbackBase.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <queue>
using ::android::hardware::bluetooth::V1_0::IBluetoothHci;
@@ -126,6 +127,23 @@
std::chrono::steady_clock::time_point start_time_;
};
+// Test environment for Bluetooth HIDL HAL.
+class BluetoothHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static BluetoothHidlEnvironment* Instance() {
+ static BluetoothHidlEnvironment* instance = new BluetoothHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override {
+ registerTestService<IBluetoothHci>();
+ }
+
+ private:
+ BluetoothHidlEnvironment() {}
+};
+
// The main test class for Bluetooth HIDL HAL.
class BluetoothHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
@@ -251,15 +269,6 @@
int max_sco_data_packets;
};
-// A class for test environment setup (kept since this file is a template).
-class BluetoothHidlEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- private:
-};
-
// Receive and check status events until a COMMAND_COMPLETE is received.
void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec<uint8_t> cmd) {
// Allow intermediate COMMAND_STATUS events
@@ -662,8 +671,9 @@
}
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new BluetoothHidlEnvironment);
+ ::testing::AddGlobalTestEnvironment(BluetoothHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ BluetoothHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
return status;
diff --git a/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp b/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp
index 5672824..7492152 100644
--- a/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp
+++ b/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "contexthub_hidl_hal_test"
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/logging.h>
#include <android/hardware/contexthub/1.0/IContexthub.h>
#include <android/hardware/contexthub/1.0/IContexthubCallback.h>
@@ -92,12 +93,27 @@
return hubIds;
}
+// Test environment for Contexthub HIDL HAL.
+class ContexthubHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static ContexthubHidlEnvironment* Instance() {
+ static ContexthubHidlEnvironment* instance = new ContexthubHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IContexthub>(); }
+ private:
+ ContexthubHidlEnvironment() {}
+};
+
// Base test fixture that initializes the HAL and makes the context hub API
// handle available
class ContexthubHidlTestBase : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- hubApi = ::testing::VtsHalHidlTargetTestBase::getService<IContexthub>();
+ hubApi = ::testing::VtsHalHidlTargetTestBase::getService<IContexthub>(
+ ContexthubHidlEnvironment::Instance()->getServiceName<IContexthub>());
ASSERT_NE(hubApi, nullptr);
// getHubs() must be called at least once for proper initialization of the
@@ -381,7 +397,11 @@
} // anonymous namespace
int main(int argc, char **argv) {
+ ::testing::AddGlobalTestEnvironment(ContexthubHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ContexthubHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI ("Test result = %d", status);
+ return status;
}
diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
index 91e75fe..8b3185d 100644
--- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
+++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
@@ -19,6 +19,7 @@
#include <log/log.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <chrono>
#include <condition_variable>
@@ -41,6 +42,21 @@
bool sAgpsIsPresent = false; // if SUPL or XTRA assistance available
bool sSignalIsWeak = false; // if GNSS signals are weak (e.g. light indoor)
+// Test environment for GNSS HIDL HAL.
+class GnssHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GnssHidlEnvironment* Instance() {
+ static GnssHidlEnvironment* instance = new GnssHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IGnss>(); }
+
+ private:
+ GnssHidlEnvironment() {}
+};
+
// The main test class for GNSS HAL.
class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
public:
@@ -51,7 +67,8 @@
info_called_count_ = 0;
notify_count_ = 0;
- gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>();
+ gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>(
+ GnssHidlEnvironment::Instance()->getServiceName<IGnss>());
ASSERT_NE(gnss_hal_, nullptr);
gnss_cb_ = new GnssCallback(*this);
@@ -449,17 +466,19 @@
}
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ GnssHidlEnvironment::Instance()->init(&argc, argv);
/*
* These arguments not used by automated VTS testing.
* Only for use in manual testing, when wanting to run
* stronger tests that require the presence of GPS signal.
*/
for (int i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-agps") == 0) {
- sAgpsIsPresent = true;
- } else if (strcmp(argv[i], "-weak") == 0) {
- sSignalIsWeak = true;
+ if (strcmp(argv[i], "-agps") == 0) {
+ sAgpsIsPresent = true;
+ } else if (strcmp(argv[i], "-weak") == 0) {
+ sSignalIsWeak = true;
}
}
int status = RUN_ALL_TESTS();
diff --git a/health/1.0/vts/functional/VtsHalHealthV1_0TargetTest.cpp b/health/1.0/vts/functional/VtsHalHealthV1_0TargetTest.cpp
index 324eb9f..335d15d 100644
--- a/health/1.0/vts/functional/VtsHalHealthV1_0TargetTest.cpp
+++ b/health/1.0/vts/functional/VtsHalHealthV1_0TargetTest.cpp
@@ -19,7 +19,9 @@
#include <android/hardware/health/1.0/IHealth.h>
#include <android/hardware/health/1.0/types.h>
#include <log/log.h>
+
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
using HealthConfig = ::android::hardware::health::V1_0::HealthConfig;
using HealthInfo = ::android::hardware::health::V1_0::HealthInfo;
@@ -28,10 +30,25 @@
using ::android::sp;
+// Test environment for Health HIDL HAL.
+class HealthHidlEnvironment : public ::testing::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() {}
+};
+
class HealthHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- health = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>();
+ health = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(
+ HealthHidlEnvironment::Instance()->getServiceName<IHealth>());
ASSERT_NE(health, nullptr);
health->init(config,
[&](const auto& halConfigOut) { config = halConfigOut; });
@@ -57,7 +74,9 @@
}
int main(int argc, char **argv) {
+ ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ HealthHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
return status;
diff --git a/light/2.0/vts/functional/VtsHalLightV2_0TargetTest.cpp b/light/2.0/vts/functional/VtsHalLightV2_0TargetTest.cpp
index 3405422..13290d9 100644
--- a/light/2.0/vts/functional/VtsHalLightV2_0TargetTest.cpp
+++ b/light/2.0/vts/functional/VtsHalLightV2_0TargetTest.cpp
@@ -16,12 +16,13 @@
#define LOG_TAG "light_hidl_hal_test"
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/logging.h>
#include <android/hardware/light/2.0/ILight.h>
#include <android/hardware/light/2.0/types.h>
-#include <VtsHalHidlTargetTestBase.h>
-#include <set>
#include <unistd.h>
+#include <set>
using ::android::hardware::light::V2_0::Brightness;
using ::android::hardware::light::V2_0::Flash;
@@ -72,10 +73,25 @@
Type::WIFI
};
+// Test environment for Light HIDL HAL.
+class LightHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static LightHidlEnvironment* Instance() {
+ static LightHidlEnvironment* instance = new LightHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<ILight>(); }
+ private:
+ LightHidlEnvironment() {}
+};
+
class LightHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- light = ::testing::VtsHalHidlTargetTestBase::getService<ILight>();
+ light = ::testing::VtsHalHidlTargetTestBase::getService<ILight>(
+ LightHidlEnvironment::Instance()->getServiceName<ILight>());
ASSERT_NE(light, nullptr);
LOG(INFO) << "Test is remote " << light->isRemote();
@@ -149,7 +165,9 @@
}
int main(int argc, char **argv) {
+ ::testing::AddGlobalTestEnvironment(LightHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ LightHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
index 2f00fbb..e17c961 100644
--- a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
+++ b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
@@ -24,6 +24,7 @@
#include <VtsHalHidlTargetCallbackBase.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
using ::android::hardware::nfc::V1_0::INfc;
using ::android::hardware::nfc::V1_0::INfcClientCallback;
@@ -93,11 +94,26 @@
};
};
+// Test environment for Nfc HIDL HAL.
+class NfcHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static NfcHidlEnvironment* Instance() {
+ static NfcHidlEnvironment* instance = new NfcHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<INfc>(); }
+ private:
+ NfcHidlEnvironment() {}
+};
+
// The main test class for NFC HIDL HAL.
class NfcHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- nfc_ = ::testing::VtsHalHidlTargetTestBase::getService<INfc>();
+ nfc_ = ::testing::VtsHalHidlTargetTestBase::getService<INfc>(
+ NfcHidlEnvironment::Instance()->getServiceName<INfc>());
ASSERT_NE(nfc_, nullptr);
nfc_cb_ = new NfcClientCallback();
@@ -163,15 +179,6 @@
sp<NfcClientCallback> nfc_cb_;
};
-// A class for test environment setup (kept since this file is a template).
-class NfcHidlEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- private:
-};
-
/*
* OpenAndClose:
* Makes an open call, waits for NfcEvent.OPEN_CPLT
@@ -586,8 +593,9 @@
}
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new NfcHidlEnvironment);
+ ::testing::AddGlobalTestEnvironment(NfcHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ NfcHidlEnvironment::Instance()->init(&argc, argv);
std::system("svc nfc disable"); /* Turn off NFC */
sleep(5);
diff --git a/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp b/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
index a5b40d4..bef412b 100644
--- a/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
+++ b/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
@@ -25,6 +25,7 @@
#include <VtsHalHidlTargetCallbackBase.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
using ::android::hardware::nfc::V1_1::INfc;
using ::android::hardware::nfc::V1_1::INfcClientCallback;
@@ -78,6 +79,20 @@
};
};
+// Test environment for Nfc HIDL HAL.
+class NfcHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static NfcHidlEnvironment* Instance() {
+ static NfcHidlEnvironment* instance = new NfcHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<INfc>(); }
+ private:
+ NfcHidlEnvironment() {}
+};
+
// The main test class for NFC HIDL HAL.
class NfcHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
@@ -127,15 +142,6 @@
sp<NfcClientCallback> nfc_cb_;
};
-// A class for test environment setup (kept since this file is a template).
-class NfcHidlEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- private:
-};
-
/*
* factoryReset
* calls factoryReset()
@@ -204,8 +210,9 @@
}
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new NfcHidlEnvironment);
+ ::testing::AddGlobalTestEnvironment(NfcHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ NfcHidlEnvironment::Instance()->init(&argc, argv);
std::system("svc nfc disable"); /* Turn off NFC */
sleep(5);
diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp
index 48ac5a1..a9c80b7 100644
--- a/radio/1.2/Android.bp
+++ b/radio/1.2/Android.bp
@@ -28,11 +28,13 @@
"CellIdentityGsm",
"CellIdentityLte",
"CellIdentityOperatorNames",
+ "CellIdentityTdscdma",
"CellIdentityWcdma",
"CellInfo",
"CellInfoCdma",
"CellInfoGsm",
"CellInfoLte",
+ "CellInfoTdscdma",
"CellInfoWcdma",
"DataRequestReason",
"IncrementalResultsPeriodicityRange",
@@ -44,6 +46,9 @@
"PhysicalChannelConfig",
"RadioConst",
"ScanIntervalRange",
+ "SignalStrength",
+ "TdscdmaSignalStrength",
+ "WcdmaSignalStrength",
],
gen_java: true,
}
diff --git a/radio/1.2/IRadio.hal b/radio/1.2/IRadio.hal
index 67ce56c..6463b0f 100644
--- a/radio/1.2/IRadio.hal
+++ b/radio/1.2/IRadio.hal
@@ -50,7 +50,7 @@
*
* @param serial Serial number of request.
* @param indicationFilter 32-bit bitmap of IndicationFilter. Bits set to 1 indicate the
- * indications are enabled. See @1.2::IndicationFilter for the definition of each bit.
+ * indications are enabled. See @1.2::IndicationFilter for the definition of each bit.
*
* Response callback is IRadioResponse.setIndicationFilterResponse()
*/
@@ -68,16 +68,16 @@
*
* @param serial Serial number of request.
* @param hysteresisMs A hysteresis time in milliseconds to prevent flapping. A value of 0
- * disables hysteresis.
+ * disables hysteresis.
* @param hysteresisDb An interval in dB defining the required magnitude change between reports.
- * hysteresisDb must be smaller than the smallest threshold delta. An
- * interval value of 0 disables hysteresis.
+ * hysteresisDb must be smaller than the smallest threshold delta. An
+ * interval value of 0 disables hysteresis.
* @param thresholdsDbm A vector of trigger thresholds in dBm. A vector size of 0 disables the
- * use of thresholds for reporting.
- * @param ran The type of network for which to apply these thresholds.
+ * use of thresholds for reporting.
+ * @param accessNetwork The type of network for which to apply these thresholds.
*/
oneway setSignalStrengthReportingCriteria(int32_t serial, int32_t hysteresisMs,
- int32_t hysteresisDb, vec<int32_t> thresholdsDbm, RadioAccessNetworks ran);
+ int32_t hysteresisDb, vec<int32_t> thresholdsDbm, AccessNetwork accessNetwork);
/**
* Sets the link capacity reporting criteria.
@@ -91,23 +91,22 @@
*
* @param serial Serial number of request.
* @param hysteresisMs A hysteresis time in milliseconds to prevent flapping. A value of 0
- * disables hysteresis.
+ * disables hysteresis.
* @param hysteresisDlKbps An interval in kbps defining the required magnitude change between DL
- * reports. hysteresisDlKbps must be smaller than the smallest threshold
- * delta. A value of 0 disables hysteresis.
+ * reports. hysteresisDlKbps must be smaller than the smallest threshold delta. A value of 0
+ * disables hysteresis.
* @param hysteresisUlKbps An interval in kbps defining the required magnitude change between UL
- * reports. hysteresisUlKbps must be smaller than the smallest threshold
- * delta. A value of 0 disables hysteresis.
+ * reports. hysteresisUlKbps must be smaller than the smallest threshold delta. A value of 0
+ * disables hysteresis.
* @param thresholdsDownlinkKbps A vector of trigger thresholds in kbps for downlink reports. A
- * vector size of 0 disables the use of DL thresholds for
- * reporting.
+ * vector size of 0 disables the use of DL thresholds for reporting.
* @param thresholdsUplinkKbps A vector of trigger thresholds in kbps for uplink reports. A
- * vector size of 0 disables the use of UL thresholds for reporting.
- * @param ran The type of network for which to apply these thresholds.
+ * vector size of 0 disables the use of UL thresholds for reporting.
+ * @param accessNetwork The type of network for which to apply these thresholds.
*/
oneway setLinkCapacityReportingCriteria(int32_t serial, int32_t hysteresisMs,
int32_t hysteresisDlKbps, int32_t hysteresisUlKbps, vec<int32_t> thresholdsDownlinkKbps,
- vec<int32_t> thresholdsUplinkKbps, RadioAccessNetworks ran);
+ vec<int32_t> thresholdsUplinkKbps, AccessNetwork accessNetwork);
/**
* Setup a packet data connection. If DataCallResponse.status returns DataCallFailCause:NONE,
diff --git a/radio/1.2/IRadioIndication.hal b/radio/1.2/IRadioIndication.hal
index a124557..3d93b98 100644
--- a/radio/1.2/IRadioIndication.hal
+++ b/radio/1.2/IRadioIndication.hal
@@ -34,7 +34,7 @@
* Same information as returned by getCellInfoList() in 1.0::IRadio.
*
* @param type Type of radio indication
- * @param records Current cell information known to radio
+ * @param records Current cell information
*/
oneway cellInfoList_1_2(RadioIndicationType type, vec<CellInfo> records);
@@ -50,7 +50,7 @@
* suppressed by @1.2::IRadio.setIndicationFilter_1_2().
*
* @param type Type of radio indication
- * @param lce LinkCapacityEstimate information as defined in types.hal
+ * @param lce LinkCapacityEstimate
*/
oneway currentLinkCapacityEstimate(RadioIndicationType type, LinkCapacityEstimate lce);
@@ -58,8 +58,16 @@
* Indicates physical channel configurations.
*
* @param type Type of radio indication
- * @param configs List of PhysicalChannelConfigs as defined in types.hal
+ * @param configs Vector of PhysicalChannelConfigs
*/
oneway currentPhysicalChannelConfigs(RadioIndicationType type,
vec<PhysicalChannelConfig> configs);
+
+ /**
+ * Indicates current signal strength of the radio.
+ *
+ * @param type Type of radio indication
+ * @param signalStrength SignalStrength information
+ */
+ oneway currentSignalStrength_1_2(RadioIndicationType type, SignalStrength signalStrength);
};
diff --git a/radio/1.2/IRadioResponse.hal b/radio/1.2/IRadioResponse.hal
index 93ec4d7..f26c9ec 100644
--- a/radio/1.2/IRadioResponse.hal
+++ b/radio/1.2/IRadioResponse.hal
@@ -88,4 +88,14 @@
* RadioError:CANCELLED
*/
oneway getCurrentCallsResponse_1_2(RadioResponseInfo info, vec<Call> calls);
+
+ /**
+ * @param signalStrength Current signal strength
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ */
+ oneway getSignalStrengthResponse_1_2(RadioResponseInfo info, SignalStrength signalStrength);
};
diff --git a/radio/1.2/types.hal b/radio/1.2/types.hal
index c353645..b68895e 100644
--- a/radio/1.2/types.hal
+++ b/radio/1.2/types.hal
@@ -17,12 +17,13 @@
package android.hardware.radio@1.2;
import @1.0::Call;
-import @1.0::CdmaSignalStrength;
import @1.0::CardState;
import @1.0::CardStatus;
+import @1.0::CdmaSignalStrength;
import @1.0::CellIdentityCdma;
import @1.0::CellIdentityGsm;
import @1.0::CellIdentityLte;
+import @1.0::CellIdentityTdscdma;
import @1.0::CellIdentityWcdma;
import @1.0::CellInfoTdscdma;
import @1.0::CellInfoType;
@@ -30,10 +31,12 @@
import @1.0::GsmSignalStrength;
import @1.0::LteSignalStrength;
import @1.0::RadioConst;
+import @1.0::RadioError;
+import @1.0::SignalStrength;
+import @1.0::TdScdmaSignalStrength;
import @1.0::TimeStampType;
import @1.0::WcdmaSignalStrength;
import @1.1::RadioAccessSpecifier;
-import @1.0::RadioError;
import @1.1::ScanStatus;
import @1.1::ScanType;
@@ -251,6 +254,15 @@
int32_t bandwidth;
};
+struct CellIdentityTdscdma {
+ @1.0::CellIdentityTdscdma base;
+ /**
+ * 16-bit UMTS Absolute RF Channel Number defined in TS 25.102 5.4.4; this value must be valid.
+ */
+ int32_t uarfcn;
+ CellIdentityOperatorNames operatorNames;
+};
+
struct CellIdentityWcdma {
@1.0::CellIdentityWcdma base;
CellIdentityOperatorNames operatorNames;
@@ -277,6 +289,11 @@
LteSignalStrength signalStrengthLte;
};
+struct CellInfoTdscdma {
+ CellIdentityTdscdma cellIdentityTdscdma;
+ TdscdmaSignalStrength signalStrengthTdscdma;
+};
+
struct CellInfo {
/**
* Cell type for selecting from union CellInfo.
@@ -344,11 +361,17 @@
struct LinkCapacityEstimate {
/**
- * Estimated downlink capacity in kbps.
+ * Estimated downlink capacity in kbps. This bandwidth estimate shall be the estimated
+ * maximum sustainable link bandwidth (as would be measured at the Upper PDCP or SNDCP SAP).
+ * If the DL Aggregate Maximum Bit Rate is known, this value shall not exceed the DL-AMBR
+ * for the Internet PDN connection.
*/
uint32_t downlinkCapacityKbps;
/**
- * Estimated uplink capacity in kbps.
+ * Estimated uplink capacity in kbps. This bandwidth estimate shall be the estimated
+ * maximum sustainable link bandwidth (as would be measured at the Upper PDCP or SNDCP SAP).
+ * If the UL Aggregate Maximum Bit Rate is known, this value shall not exceed the UL-AMBR
+ * for the Internet PDN connection.
*/
uint32_t uplinkCapacityKbps;
};
@@ -397,3 +420,45 @@
@1.0::Call base;
AudioQuality audioQuality;
};
+
+struct WcdmaSignalStrength {
+ @1.0::WcdmaSignalStrength base;
+ /**
+ * CPICH RSCP as defined in TS 25.215 5.1.1
+ * Valid values are (0-96, 255) as defined in TS 27.007 8.69
+ */
+ uint32_t rscp;
+ /**
+ * Ec/No value as defined in TS 25.215 5.1.5
+ * Valid values are (0-49, 255) as defined in TS 27.007 8.69
+ */
+ uint32_t ecno;
+
+};
+
+struct TdscdmaSignalStrength {
+ /**
+ * UTRA carrier RSSI as defined in TS 25.225 5.1.4
+ * Valid values are (0-96, 99) as defined in TS 27.007 8.69
+ */
+ uint32_t signalStrength;
+ /**
+ * Transport Channel BER as defined in TS 25.225 5.2.5
+ * Valid values are (0-49, 99) as defined in TS 27.007 8.69
+ */
+ uint32_t bitErrorRate;
+ /**
+ * P-CCPCH RSCP as defined in TS 25.225 5.1.1
+ * Valid values are (0-96, 255) as defined in TS 27.007 8.69
+ */
+ uint32_t rscp;
+};
+
+struct SignalStrength {
+ GsmSignalStrength gsm;
+ CdmaSignalStrength cdma;
+ EvdoSignalStrength evdo;
+ LteSignalStrength lte;
+ TdScdmaSignalStrength tdScdma;
+ WcdmaSignalStrength wcdma;
+};
diff --git a/thermal/1.0/vts/functional/VtsHalThermalV1_0TargetTest.cpp b/thermal/1.0/vts/functional/VtsHalThermalV1_0TargetTest.cpp
index dfa11a1..6f059ef 100644
--- a/thermal/1.0/vts/functional/VtsHalThermalV1_0TargetTest.cpp
+++ b/thermal/1.0/vts/functional/VtsHalThermalV1_0TargetTest.cpp
@@ -21,10 +21,11 @@
#define LOG_TAG "thermal_hidl_hal_test"
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/logging.h>
#include <android/hardware/thermal/1.0/IThermal.h>
#include <android/hardware/thermal/1.0/types.h>
-#include <VtsHalHidlTargetTestBase.h>
#include <unistd.h>
using ::android::hardware::hidl_string;
@@ -45,11 +46,26 @@
#define MAX_DEVICE_TEMPERATURE 200
#define MAX_FAN_SPEED 20000
+// Test environment for Thermal HIDL HAL.
+class ThermalHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static ThermalHidlEnvironment* Instance() {
+ static ThermalHidlEnvironment* instance = new ThermalHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IThermal>(); }
+ private:
+ ThermalHidlEnvironment() {}
+};
+
// The main test class for THERMAL HIDL HAL.
class ThermalHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- thermal_ = ::testing::VtsHalHidlTargetTestBase::getService<IThermal>();
+ thermal_ = ::testing::VtsHalHidlTargetTestBase::getService<IThermal>(
+ ThermalHidlEnvironment::Instance()->getServiceName<IThermal>());
ASSERT_NE(thermal_, nullptr);
baseSize_ = 0;
names_.clear();
@@ -207,7 +223,9 @@
}
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(ThermalHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ ThermalHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/thermal/1.1/vts/functional/VtsHalThermalV1_1TargetTest.cpp b/thermal/1.1/vts/functional/VtsHalThermalV1_1TargetTest.cpp
index 6c1599b..91c8b6e 100644
--- a/thermal/1.1/vts/functional/VtsHalThermalV1_1TargetTest.cpp
+++ b/thermal/1.1/vts/functional/VtsHalThermalV1_1TargetTest.cpp
@@ -20,6 +20,7 @@
#include <VtsHalHidlTargetCallbackBase.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
using ::android::hardware::thermal::V1_0::Temperature;
using ::android::hardware::thermal::V1_0::TemperatureType;
@@ -62,11 +63,26 @@
}
};
+// Test environment for Thermal HIDL HAL.
+class ThermalHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static ThermalHidlEnvironment* Instance() {
+ static ThermalHidlEnvironment* instance = new ThermalHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IThermal>(); }
+ private:
+ ThermalHidlEnvironment() {}
+};
+
// The main test class for THERMAL HIDL HAL 1.1.
class ThermalHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- mThermal = ::testing::VtsHalHidlTargetTestBase::getService<IThermal>();
+ mThermal = ::testing::VtsHalHidlTargetTestBase::getService<IThermal>(
+ ThermalHidlEnvironment::Instance()->getServiceName<IThermal>());
ASSERT_NE(mThermal, nullptr);
mThermalCallback = new(std::nothrow) ThermalCallback();
ASSERT_NE(mThermalCallback, nullptr);
@@ -99,7 +115,9 @@
}
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(ThermalHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ ThermalHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
cout << "Test result = " << status << std::endl;
return status;
diff --git a/vibrator/1.0/vts/functional/VtsHalVibratorV1_0TargetTest.cpp b/vibrator/1.0/vts/functional/VtsHalVibratorV1_0TargetTest.cpp
index f415ad5..a0e927b 100644
--- a/vibrator/1.0/vts/functional/VtsHalVibratorV1_0TargetTest.cpp
+++ b/vibrator/1.0/vts/functional/VtsHalVibratorV1_0TargetTest.cpp
@@ -19,9 +19,11 @@
#include <android-base/logging.h>
#include <android/hardware/vibrator/1.0/IVibrator.h>
#include <android/hardware/vibrator/1.0/types.h>
-#include <VtsHalHidlTargetTestBase.h>
#include <unistd.h>
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+
using ::android::hardware::vibrator::V1_0::Effect;
using ::android::hardware::vibrator::V1_0::EffectStrength;
using ::android::hardware::vibrator::V1_0::IVibrator;
@@ -30,11 +32,27 @@
using ::android::hardware::Void;
using ::android::sp;
+// Test environment for Vibrator HIDL HAL.
+class VibratorHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static VibratorHidlEnvironment* Instance() {
+ static VibratorHidlEnvironment* instance = new VibratorHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IVibrator>(); }
+
+ private:
+ VibratorHidlEnvironment() {}
+};
+
// The main test class for VIBRATOR HIDL HAL.
class VibratorHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- vibrator = ::testing::VtsHalHidlTargetTestBase::getService<IVibrator>();
+ vibrator = ::testing::VtsHalHidlTargetTestBase::getService<IVibrator>(
+ VibratorHidlEnvironment::Instance()->getServiceName<IVibrator>());
ASSERT_NE(vibrator, nullptr);
}
@@ -43,15 +61,6 @@
sp<IVibrator> vibrator;
};
-// A class for test environment setup (kept since this file is a template).
-class VibratorHidlEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- private:
-};
-
static void validatePerformEffect(Status status, uint32_t lengthMs) {
ASSERT_TRUE(status == Status::OK || status == Status::UNSUPPORTED_OPERATION);
if (status == Status::OK) {
@@ -96,8 +105,9 @@
}
int main(int argc, char **argv) {
- ::testing::AddGlobalTestEnvironment(new VibratorHidlEnvironment);
+ ::testing::AddGlobalTestEnvironment(VibratorHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ VibratorHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/vibrator/1.1/vts/functional/VtsHalVibratorV1_1TargetTest.cpp b/vibrator/1.1/vts/functional/VtsHalVibratorV1_1TargetTest.cpp
index 35000f8..1a47fe9 100644
--- a/vibrator/1.1/vts/functional/VtsHalVibratorV1_1TargetTest.cpp
+++ b/vibrator/1.1/vts/functional/VtsHalVibratorV1_1TargetTest.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "vibrator_hidl_hal_test"
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/logging.h>
#include <android/hardware/vibrator/1.1/IVibrator.h>
#include <android/hardware/vibrator/1.1/types.h>
@@ -31,11 +32,27 @@
using ::android::hardware::Void;
using ::android::sp;
+// Test environment for Vibrator HIDL HAL.
+class VibratorHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static VibratorHidlEnvironment* Instance() {
+ static VibratorHidlEnvironment* instance = new VibratorHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IVibrator>(); }
+
+ private:
+ VibratorHidlEnvironment() {}
+};
+
// The main test class for VIBRATOR HIDL HAL 1.1.
class VibratorHidlTest_1_1 : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- vibrator = ::testing::VtsHalHidlTargetTestBase::getService<IVibrator>();
+ vibrator = ::testing::VtsHalHidlTargetTestBase::getService<IVibrator>(
+ VibratorHidlEnvironment::Instance()->getServiceName<IVibrator>());
ASSERT_NE(vibrator, nullptr);
}
@@ -61,7 +78,9 @@
}
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(VibratorHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ VibratorHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index ea27f02..b2f76a3 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -20,7 +20,8 @@
srcs: [
"wifi_hidl_call_util_selftest.cpp",
"wifi_hidl_test.cpp",
- "wifi_hidl_test_utils.cpp"],
+ "wifi_hidl_test_utils.cpp",
+ ],
export_include_dirs: [
"."
],
diff --git a/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
index beac039..e7b8593 100644
--- a/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
+++ b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
@@ -16,16 +16,31 @@
#include <android-base/logging.h>
-#include <VtsHalHidlTargetTestBase.h>
-
#include "wifi_hidl_test_utils.h"
-WifiHidlEnvironment* gEnv;
+class WifiVtsHidlEnvironment_1_0 : public WifiHidlEnvironment {
+ public:
+ // get the test environment singleton
+ static WifiVtsHidlEnvironment_1_0* Instance() {
+ static WifiVtsHidlEnvironment_1_0* instance =
+ new WifiVtsHidlEnvironment_1_0;
+ return instance;
+ }
+
+ virtual void registerTestServices() override {
+ registerTestService<android::hardware::wifi::V1_0::IWifi>();
+ }
+
+ private:
+ WifiVtsHidlEnvironment_1_0() {}
+};
+
+WifiHidlEnvironment* gEnv = WifiVtsHidlEnvironment_1_0::Instance();
int main(int argc, char** argv) {
- gEnv = new WifiHidlEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();
diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
index 0851cb2..88a4217 100644
--- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
+++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
@@ -35,6 +35,8 @@
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
+extern WifiHidlEnvironment* gEnv;
+
namespace {
constexpr uint32_t kHalStartRetryMaxCount = 5;
constexpr uint32_t kHalStartRetryIntervalInMs = 2;
@@ -86,7 +88,8 @@
} // namespace
sp<IWifi> getWifi() {
- sp<IWifi> wifi = ::testing::VtsHalHidlTargetTestBase::getService<IWifi>();
+ sp<IWifi> wifi = ::testing::VtsHalHidlTargetTestBase::getService<IWifi>(
+ gEnv->getServiceName<IWifi>());
return wifi;
}
diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
index c4a19dd..2b1c8ec 100644
--- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
+++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
@@ -26,6 +26,7 @@
#include <getopt.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
// Helper functions to obtain references to the various HIDL interface objects.
// Note: We only have a single instance of each of these objects currently.
// These helper functions should be modified to return vectors if we support
@@ -47,9 +48,9 @@
// Used to trigger IWifi.stop() at the end of every test.
void stopWifi();
-class WifiHidlEnvironment : public ::testing::Environment {
+class WifiHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
protected:
- virtual void SetUp() override {
+ virtual void HidlSetUp() override {
stopWifi();
sleep(5);
}
diff --git a/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp b/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp
index 9b92b57..a0f97f8 100644
--- a/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp
+++ b/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp
@@ -15,17 +15,32 @@
*/
#include <android-base/logging.h>
-
-#include <VtsHalHidlTargetTestBase.h>
+#include <android/hardware/wifi/1.1/IWifi.h>
#include "wifi_hidl_test_utils.h"
-WifiHidlEnvironment* gEnv;
+class WifiHidlEnvironment_1_1 : public WifiHidlEnvironment {
+ public:
+ // get the test environment singleton
+ static WifiHidlEnvironment_1_1* Instance() {
+ static WifiHidlEnvironment_1_1* instance = new WifiHidlEnvironment_1_1;
+ return instance;
+ }
+
+ virtual void registerTestServices() override {
+ registerTestService<android::hardware::wifi::V1_1::IWifi>();
+ }
+
+ private:
+ WifiHidlEnvironment_1_1() {}
+};
+
+WifiHidlEnvironment* gEnv = WifiHidlEnvironment_1_1::Instance();
int main(int argc, char** argv) {
- gEnv = new WifiHidlEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
int status = RUN_ALL_TESTS();
diff --git a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
index 90c36dd..dbe4e74 100644
--- a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
+++ b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
@@ -23,6 +23,7 @@
#include <VtsHalHidlTargetCallbackBase.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <vector>
@@ -68,12 +69,33 @@
OffloadStatus error_code_;
};
+// Test environment for Weaver HIDL HAL.
+class WifiOffloadHidlEnvironment
+ : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static WifiOffloadHidlEnvironment* Instance() {
+ static WifiOffloadHidlEnvironment* instance =
+ new WifiOffloadHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override {
+ registerTestService<IOffload>();
+ }
+
+ private:
+ WifiOffloadHidlEnvironment() {}
+};
+
// The main test class for WifiOffload HIDL HAL.
class WifiOffloadHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
wifi_offload_ =
- ::testing::VtsHalHidlTargetTestBase::getService<IOffload>();
+ ::testing::VtsHalHidlTargetTestBase::getService<IOffload>(
+ WifiOffloadHidlEnvironment::Instance()
+ ->getServiceName<IOffload>());
ASSERT_NE(wifi_offload_, nullptr);
wifi_offload_cb_ = new OffloadCallback();
@@ -209,17 +231,10 @@
ASSERT_EQ(true, res.no_timeout);
}
-// A class for test environment setup
-class WifiOffloadHalHidlEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-};
-
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new WifiOffloadHalHidlEnvironment);
+ ::testing::AddGlobalTestEnvironment(WifiOffloadHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
-
+ WifiOffloadHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
diff --git a/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp b/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
index 33f3049..adf2a85 100644
--- a/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
+++ b/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
@@ -16,22 +16,34 @@
#include <android-base/logging.h>
-#include <VtsHalHidlTargetTestBase.h>
-
#include "supplicant_hidl_test_utils.h"
+#include "wifi_hidl_test_utils.h"
-class SupplicantHidlEnvironment : public ::testing::Environment {
+class WifiSupplicantHidlEnvironment_1_0 : public WifiSupplicantHidlEnvironment {
public:
- virtual void SetUp() override {
- stopSupplicant();
+ // get the test environment singleton
+ static WifiSupplicantHidlEnvironment_1_0* Instance() {
+ static WifiSupplicantHidlEnvironment_1_0* instance =
+ new WifiSupplicantHidlEnvironment_1_0;
+ return instance;
}
- virtual void TearDown() override {
+ virtual void registerTestServices() override {
+ registerTestService<::android::hardware::wifi::V1_0::IWifi>();
+ registerTestService<
+ ::android::hardware::wifi::supplicant::V1_0::ISupplicant>();
}
+
+ private:
+ WifiSupplicantHidlEnvironment_1_0() {}
};
+WifiSupplicantHidlEnvironment* gEnv =
+ WifiSupplicantHidlEnvironment_1_0::Instance();
+
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new SupplicantHidlEnvironment);
+ ::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index 3b75508..6dd64ec 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#include <android-base/logging.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <android-base/logging.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <android/hidl/manager/1.0/IServiceNotification.h>
@@ -49,8 +49,9 @@
using ::android::wifi_system::InterfaceTool;
using ::android::wifi_system::SupplicantManager;
+extern WifiSupplicantHidlEnvironment* gEnv;
+
namespace {
-const char kSupplicantServiceName[] = "default";
// Helper function to initialize the driver and firmware to STA mode
// using the vendor HAL HIDL interface.
@@ -153,19 +154,20 @@
android::sp<ServiceNotificationListener> notification_listener =
new ServiceNotificationListener();
+ string service_name = gEnv->getServiceName<ISupplicant>();
ASSERT_TRUE(notification_listener->registerForHidlServiceNotifications(
- kSupplicantServiceName));
+ service_name));
SupplicantManager supplicant_manager;
ASSERT_TRUE(supplicant_manager.StartSupplicant());
ASSERT_TRUE(supplicant_manager.IsSupplicantRunning());
- ASSERT_TRUE(
- notification_listener->waitForHidlService(200, kSupplicantServiceName));
+ ASSERT_TRUE(notification_listener->waitForHidlService(200, service_name));
}
sp<ISupplicant> getSupplicant() {
- return ::testing::VtsHalHidlTargetTestBase::getService<ISupplicant>();
+ return ::testing::VtsHalHidlTargetTestBase::getService<ISupplicant>(
+ gEnv->getServiceName<ISupplicant>());
}
sp<ISupplicantStaIface> getSupplicantStaIface() {
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
index 38143e4..4426ab6 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
@@ -22,6 +22,8 @@
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+
// Used to stop the android wifi framework before every test.
void stopWifiFramework();
void startWifiFramework();
@@ -45,4 +47,13 @@
bool turnOnExcessiveLogging();
+class WifiSupplicantHidlEnvironment
+ : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ virtual void HidlSetUp() override { stopSupplicant(); }
+ virtual void HidlTearDown() override {
+ startSupplicantAndWaitForHidlService();
+ }
+};
+
#endif /* SUPPLICANT_HIDL_TEST_UTILS_H */