Merge "Add INFO_MODEL and INFO_MODEL_YEAR default values" into rvc-qpr-dev
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index d9ac239..9a0d89d 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -108,6 +108,9 @@
srcs: [
"impl/vhal_v2_0/EmulatedUserHal.cpp",
],
+ whole_static_libs: [
+ "android.hardware.automotive.vehicle@2.0-user-hal-helper-lib",
+ ],
}
// Vehicle HAL Server reference impl lib
@@ -143,6 +146,7 @@
],
whole_static_libs: [
"android.hardware.automotive.vehicle@2.0-server-common-lib",
+ "android.hardware.automotive.vehicle@2.0-user-hal-helper-lib",
],
static_libs: [
"android.hardware.automotive.vehicle@2.0-libproto-native",
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp
index d0011a8..3bdf5a8 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp
@@ -15,10 +15,12 @@
*/
#define LOG_TAG "EmulatedUserHal"
+#include "EmulatedUserHal.h"
+
#include <cutils/log.h>
#include <utils/SystemClock.h>
-#include "EmulatedUserHal.h"
+#include "UserHalHelper.h"
namespace android {
namespace hardware {
@@ -28,12 +30,35 @@
namespace impl {
-constexpr int INITIAL_USER_INFO = static_cast<int>(VehicleProperty::INITIAL_USER_INFO);
-constexpr int SWITCH_USER = static_cast<int>(VehicleProperty::SWITCH_USER);
-constexpr int CREATE_USER = static_cast<int>(VehicleProperty::CREATE_USER);
-constexpr int REMOVE_USER = static_cast<int>(VehicleProperty::REMOVE_USER);
-constexpr int USER_IDENTIFICATION_ASSOCIATION =
- static_cast<int>(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION);
+namespace {
+
+using android::base::Error;
+using android::base::Result;
+
+constexpr int32_t INITIAL_USER_INFO = static_cast<int32_t>(VehicleProperty::INITIAL_USER_INFO);
+constexpr int32_t SWITCH_USER = static_cast<int32_t>(VehicleProperty::SWITCH_USER);
+constexpr int32_t CREATE_USER = static_cast<int32_t>(VehicleProperty::CREATE_USER);
+constexpr int32_t REMOVE_USER = static_cast<int32_t>(VehicleProperty::REMOVE_USER);
+constexpr int32_t USER_IDENTIFICATION_ASSOCIATION =
+ static_cast<int32_t>(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION);
+
+Result<int32_t> getRequestId(const VehiclePropValue& value) {
+ if (value.value.int32Values.size() < 1) {
+ return Error(static_cast<int>(StatusCode::INVALID_ARG))
+ << "no int32values on " << toString(value);
+ }
+ return value.value.int32Values[0];
+}
+
+Result<SwitchUserMessageType> getSwitchUserMessageType(const VehiclePropValue& value) {
+ if (value.value.int32Values.size() < 2) {
+ return Error(static_cast<int>(StatusCode::INVALID_ARG))
+ << "missing switch user message type " << toString(value);
+ }
+ return user_hal_helper::verifyAndCast<SwitchUserMessageType>(value.value.int32Values[1]);
+}
+
+} // namespace
bool EmulatedUserHal::isSupported(int32_t prop) {
switch (prop) {
@@ -48,7 +73,7 @@
}
}
-android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetProperty(
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetProperty(
const VehiclePropValue& value) {
ALOGV("onSetProperty(): %s", toString(value).c_str());
@@ -65,12 +90,12 @@
case USER_IDENTIFICATION_ASSOCIATION:
return onSetUserIdentificationAssociation(value);
default:
- return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
+ return Error(static_cast<int>(StatusCode::INVALID_ARG))
<< "Unsupported property: " << toString(value);
}
}
-android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onGetProperty(
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onGetProperty(
const VehiclePropValue& value) {
ALOGV("onGetProperty(%s)", toString(value).c_str());
switch (value.prop) {
@@ -79,42 +104,41 @@
case CREATE_USER:
case REMOVE_USER:
ALOGE("onGetProperty(): %d is only supported on SET", value.prop);
- return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
- << "only supported on SET";
+ return Error(static_cast<int>(StatusCode::INVALID_ARG)) << "only supported on SET";
case USER_IDENTIFICATION_ASSOCIATION:
return onGetUserIdentificationAssociation(value);
default:
ALOGE("onGetProperty(): %d is not supported", value.prop);
- return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
- << "not supported by User HAL";
+ return Error(static_cast<int>(StatusCode::INVALID_ARG)) << "not supported by User HAL";
}
}
-android::base::Result<std::unique_ptr<VehiclePropValue>>
-EmulatedUserHal::onGetUserIdentificationAssociation(const VehiclePropValue& value) {
- if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) {
- ALOGI("get(USER_IDENTIFICATION_ASSOCIATION): returning %s",
- toString(*mSetUserIdentificationAssociationResponseFromCmd).c_str());
- auto newValue = std::unique_ptr<VehiclePropValue>(
- new VehiclePropValue(*mSetUserIdentificationAssociationResponseFromCmd));
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onGetUserIdentificationAssociation(
+ const VehiclePropValue& value) {
+ if (mSetUserIdentificationAssociationResponseFromCmd == nullptr) {
+ return defaultUserIdentificationAssociation(value);
+ }
+ ALOGI("get(USER_IDENTIFICATION_ASSOCIATION): returning %s",
+ toString(*mSetUserIdentificationAssociationResponseFromCmd).c_str());
+ auto newValue = std::unique_ptr<VehiclePropValue>(
+ new VehiclePropValue(*mSetUserIdentificationAssociationResponseFromCmd));
+ auto requestId = getRequestId(value);
+ if (requestId.ok()) {
// Must use the same requestId
- if (value.value.int32Values.size() > 0) {
- newValue->value.int32Values[0] = value.value.int32Values[0];
- } else {
- ALOGE("get(USER_IDENTIFICATION_ASSOCIATION): no requestId on %s",
- toString(value).c_str());
- }
- return newValue;
+ newValue->value.int32Values[0] = *requestId;
+ } else {
+ ALOGE("get(USER_IDENTIFICATION_ASSOCIATION): no requestId on %s", toString(value).c_str());
}
- return defaultUserIdentificationAssociation(value);
+ return newValue;
}
-android::base::Result<std::unique_ptr<VehiclePropValue>>
-EmulatedUserHal::onSetInitialUserInfoResponse(const VehiclePropValue& value) {
- if (value.value.int32Values.size() == 0) {
- ALOGE("set(INITIAL_USER_INFO): no int32values, ignoring it: %s", toString(value).c_str());
- return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
- << "no int32values on " << toString(value);
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetInitialUserInfoResponse(
+ const VehiclePropValue& value) {
+ auto requestId = getRequestId(value);
+ if (!requestId.ok()) {
+ ALOGE("Failed to get requestId on set(INITIAL_USER_INFO): %s",
+ requestId.error().message().c_str());
+ return requestId.error();
}
if (value.areaId != 0) {
@@ -124,40 +148,40 @@
}
ALOGD("set(INITIAL_USER_INFO) called from Android: %s", toString(value).c_str());
-
- int32_t requestId = value.value.int32Values[0];
if (mInitialUserResponseFromCmd != nullptr) {
ALOGI("replying INITIAL_USER_INFO with lshal value: %s",
toString(*mInitialUserResponseFromCmd).c_str());
- return sendUserHalResponse(std::move(mInitialUserResponseFromCmd), requestId);
+ return sendUserHalResponse(std::move(mInitialUserResponseFromCmd), *requestId);
}
// Returns default response
- auto updatedValue = std::unique_ptr<VehiclePropValue>(new VehiclePropValue);
- updatedValue->prop = INITIAL_USER_INFO;
- updatedValue->timestamp = elapsedRealtimeNano();
- updatedValue->value.int32Values.resize(2);
- updatedValue->value.int32Values[0] = requestId;
- updatedValue->value.int32Values[1] = (int32_t)InitialUserInfoResponseAction::DEFAULT;
-
+ auto updatedValue = user_hal_helper::toVehiclePropValue(InitialUserInfoResponse{
+ .requestId = *requestId,
+ .action = InitialUserInfoResponseAction::DEFAULT,
+ });
ALOGI("no lshal response; replying with InitialUserInfoResponseAction::DEFAULT: %s",
toString(*updatedValue).c_str());
-
return updatedValue;
}
-android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetSwitchUserResponse(
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetSwitchUserResponse(
const VehiclePropValue& value) {
- if (value.value.int32Values.size() == 0) {
- ALOGE("set(SWITCH_USER): no int32values, ignoring it: %s", toString(value).c_str());
- return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
- << "no int32values on " << toString(value);
+ auto requestId = getRequestId(value);
+ if (!requestId.ok()) {
+ ALOGE("Failed to get requestId on set(SWITCH_USER): %s",
+ requestId.error().message().c_str());
+ return requestId.error();
+ }
+
+ auto messageType = getSwitchUserMessageType(value);
+ if (!messageType.ok()) {
+ ALOGE("Failed to get messageType on set(SWITCH_USER): %s",
+ messageType.error().message().c_str());
+ return messageType.error();
}
if (value.areaId != 0) {
- if (value.value.int32Values.size() >= 2 &&
- static_cast<SwitchUserMessageType>(value.value.int32Values[1]) ==
- SwitchUserMessageType::VEHICLE_REQUEST) {
+ if (*messageType == SwitchUserMessageType::VEHICLE_REQUEST) {
// User HAL can also request a user switch, so we need to check it first
ALOGD("set(SWITCH_USER) called from lshal to emulate a vehicle request: %s",
toString(value).c_str());
@@ -170,48 +194,36 @@
}
ALOGD("set(SWITCH_USER) called from Android: %s", toString(value).c_str());
- int32_t requestId = value.value.int32Values[0];
if (mSwitchUserResponseFromCmd != nullptr) {
ALOGI("replying SWITCH_USER with lshal value: %s",
toString(*mSwitchUserResponseFromCmd).c_str());
- return sendUserHalResponse(std::move(mSwitchUserResponseFromCmd), requestId);
+ return sendUserHalResponse(std::move(mSwitchUserResponseFromCmd), *requestId);
}
- if (value.value.int32Values.size() > 1) {
- auto messageType = static_cast<SwitchUserMessageType>(value.value.int32Values[1]);
- switch (messageType) {
- case SwitchUserMessageType::LEGACY_ANDROID_SWITCH:
- ALOGI("request is LEGACY_ANDROID_SWITCH; ignoring it");
- return {};
- case SwitchUserMessageType::ANDROID_POST_SWITCH:
- ALOGI("request is ANDROID_POST_SWITCH; ignoring it");
- return {};
- default:
- break;
- }
+ if (*messageType == SwitchUserMessageType::LEGACY_ANDROID_SWITCH ||
+ *messageType == SwitchUserMessageType::ANDROID_POST_SWITCH) {
+ ALOGI("request is %s; ignoring it", toString(*messageType).c_str());
+ return {};
}
// Returns default response
- auto updatedValue = std::unique_ptr<VehiclePropValue>(new VehiclePropValue);
- updatedValue->prop = SWITCH_USER;
- updatedValue->timestamp = elapsedRealtimeNano();
- updatedValue->value.int32Values.resize(3);
- updatedValue->value.int32Values[0] = requestId;
- updatedValue->value.int32Values[1] = (int32_t)SwitchUserMessageType::VEHICLE_RESPONSE;
- updatedValue->value.int32Values[2] = (int32_t)SwitchUserStatus::SUCCESS;
-
+ auto updatedValue = user_hal_helper::toVehiclePropValue(SwitchUserResponse{
+ .requestId = *requestId,
+ .messageType = SwitchUserMessageType::VEHICLE_RESPONSE,
+ .status = SwitchUserStatus::SUCCESS,
+ });
ALOGI("no lshal response; replying with VEHICLE_RESPONSE / SUCCESS: %s",
toString(*updatedValue).c_str());
-
return updatedValue;
}
-android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetCreateUserResponse(
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetCreateUserResponse(
const VehiclePropValue& value) {
- if (value.value.int32Values.size() == 0) {
- ALOGE("set(CREATE_USER): no int32values, ignoring it: %s", toString(value).c_str());
- return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
- << "no int32values on " << toString(value);
+ auto requestId = getRequestId(value);
+ if (!requestId.ok()) {
+ ALOGE("Failed to get requestId on set(CREATE_USER): %s",
+ requestId.error().message().c_str());
+ return requestId.error();
}
if (value.areaId != 0) {
@@ -221,33 +233,28 @@
}
ALOGD("set(CREATE_USER) called from Android: %s", toString(value).c_str());
- int32_t requestId = value.value.int32Values[0];
if (mCreateUserResponseFromCmd != nullptr) {
ALOGI("replying CREATE_USER with lshal value: %s",
toString(*mCreateUserResponseFromCmd).c_str());
- return sendUserHalResponse(std::move(mCreateUserResponseFromCmd), requestId);
+ return sendUserHalResponse(std::move(mCreateUserResponseFromCmd), *requestId);
}
// Returns default response
- auto updatedValue = std::unique_ptr<VehiclePropValue>(new VehiclePropValue);
- updatedValue->prop = CREATE_USER;
- updatedValue->timestamp = elapsedRealtimeNano();
- updatedValue->value.int32Values.resize(2);
- updatedValue->value.int32Values[0] = requestId;
- updatedValue->value.int32Values[1] = (int32_t)CreateUserStatus::SUCCESS;
-
+ auto updatedValue = user_hal_helper::toVehiclePropValue(CreateUserResponse{
+ .requestId = *requestId,
+ .status = CreateUserStatus::SUCCESS,
+ });
ALOGI("no lshal response; replying with SUCCESS: %s", toString(*updatedValue).c_str());
-
return updatedValue;
}
-android::base::Result<std::unique_ptr<VehiclePropValue>>
-EmulatedUserHal::onSetUserIdentificationAssociation(const VehiclePropValue& value) {
- if (value.value.int32Values.size() == 0) {
- ALOGE("set(USER_IDENTIFICATION_ASSOCIATION): no int32values, ignoring it: %s",
- toString(value).c_str());
- return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG))
- << "no int32values on " << toString(value);
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetUserIdentificationAssociation(
+ const VehiclePropValue& value) {
+ auto requestId = getRequestId(value);
+ if (!requestId.ok()) {
+ ALOGE("Failed to get requestId on set(USER_IDENTIFICATION_ASSOCIATION): %s",
+ requestId.error().message().c_str());
+ return requestId.error();
}
if (value.areaId != 0) {
@@ -258,28 +265,26 @@
}
ALOGD("set(USER_IDENTIFICATION_ASSOCIATION) called from Android: %s", toString(value).c_str());
- int32_t requestId = value.value.int32Values[0];
if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) {
ALOGI("replying USER_IDENTIFICATION_ASSOCIATION with lshal value: %s",
toString(*mSetUserIdentificationAssociationResponseFromCmd).c_str());
// Not moving response so it can be used on GET requests
auto copy = std::unique_ptr<VehiclePropValue>(
new VehiclePropValue(*mSetUserIdentificationAssociationResponseFromCmd));
- return sendUserHalResponse(std::move(copy), requestId);
+ return sendUserHalResponse(std::move(copy), *requestId);
}
-
// Returns default response
return defaultUserIdentificationAssociation(value);
}
-android::base::Result<std::unique_ptr<VehiclePropValue>>
-EmulatedUserHal::defaultUserIdentificationAssociation(const VehiclePropValue& request) {
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::defaultUserIdentificationAssociation(
+ const VehiclePropValue& request) {
// TODO(b/159498909): return a response with NOT_ASSOCIATED_ANY_USER for all requested types
ALOGE("no lshal response for %s; replying with NOT_AVAILABLE", toString(request).c_str());
- return android::base::Error(static_cast<int>(StatusCode::NOT_AVAILABLE)) << "not set by lshal";
+ return Error(static_cast<int>(StatusCode::NOT_AVAILABLE)) << "not set by lshal";
}
-android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::sendUserHalResponse(
+Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::sendUserHalResponse(
std::unique_ptr<VehiclePropValue> response, int32_t requestId) {
switch (response->areaId) {
case 1:
@@ -293,17 +298,16 @@
case 3:
ALOGD("not generating a property change event because of lshal prop: %s",
toString(*response).c_str());
- return android::base::Error(static_cast<int>(StatusCode::NOT_AVAILABLE))
+ return Error(static_cast<int>(StatusCode::NOT_AVAILABLE))
<< "not generating a property change event because of lshal prop: "
<< toString(*response);
default:
ALOGE("invalid action on lshal response: %s", toString(*response).c_str());
- return android::base::Error(static_cast<int>(StatusCode::INTERNAL_ERROR))
+ return Error(static_cast<int>(StatusCode::INTERNAL_ERROR))
<< "invalid action on lshal response: " << toString(*response);
}
ALOGD("updating property to: %s", toString(*response).c_str());
-
return response;
}
diff --git a/automotive/vehicle/2.0/utils/UserHalHelper.cpp b/automotive/vehicle/2.0/utils/UserHalHelper.cpp
index 33b3948..fcfe4bf 100644
--- a/automotive/vehicle/2.0/utils/UserHalHelper.cpp
+++ b/automotive/vehicle/2.0/utils/UserHalHelper.cpp
@@ -36,22 +36,6 @@
static const size_t kNumFieldsPerUserInfo = 2;
static const size_t kNumFieldsPerSetAssociation = 2;
-template <typename T>
-Result<T> verifyAndCast(int32_t value) {
- T castValue = static_cast<T>(value);
- const auto iter = hidl_enum_range<T>();
- if (castValue < *iter.begin() || castValue > *std::prev(iter.end())) {
- return Error() << "Value " << value << " not in range [" << toString(*iter.begin()) << ", "
- << toString(*std::prev(iter.end())) << "]";
- }
- for (const auto& v : hidl_enum_range<T>()) {
- if (castValue == v) {
- return castValue;
- }
- }
- return Error() << "Value " << value << " not in enum values";
-}
-
Result<void> verifyPropValue(const VehiclePropValue& propValue, VehicleProperty vehicleProperty,
size_t minInt32Values) {
auto prop = verifyAndCast<VehicleProperty>(propValue.prop);
@@ -154,6 +138,22 @@
} // namespace
+template <typename T>
+Result<T> verifyAndCast(int32_t value) {
+ T castValue = static_cast<T>(value);
+ const auto iter = hidl_enum_range<T>();
+ if (castValue < *iter.begin() || castValue > *std::prev(iter.end())) {
+ return Error() << "Value " << value << " not in range [" << toString(*iter.begin()) << ", "
+ << toString(*std::prev(iter.end())) << "]";
+ }
+ for (const auto& v : hidl_enum_range<T>()) {
+ if (castValue == v) {
+ return castValue;
+ }
+ }
+ return Error() << "Value " << value << " not in enum values";
+}
+
Result<InitialUserInfoRequest> toInitialUserInfoRequest(const VehiclePropValue& propValue) {
auto ret = verifyPropValue(propValue, VehicleProperty::INITIAL_USER_INFO, 2);
if (!ret.ok()) {
@@ -186,7 +186,8 @@
if (*messageType != SwitchUserMessageType::LEGACY_ANDROID_SWITCH &&
*messageType != SwitchUserMessageType::ANDROID_SWITCH &&
*messageType != SwitchUserMessageType::ANDROID_POST_SWITCH) {
- return Error() << "Invalid " << toString(*messageType) << " from Android System";
+ return Error() << "Invalid " << toString(*messageType)
+ << " message type from Android System";
}
request.requestId = propValue.value.int32Values[0];
request.messageType = *messageType;
diff --git a/automotive/vehicle/2.0/utils/UserHalHelper.h b/automotive/vehicle/2.0/utils/UserHalHelper.h
index bee34cf..fad7145 100644
--- a/automotive/vehicle/2.0/utils/UserHalHelper.h
+++ b/automotive/vehicle/2.0/utils/UserHalHelper.h
@@ -31,6 +31,11 @@
namespace user_hal_helper {
+// Verify whether the |value| can be casted to the type |T| and return the casted value on success.
+// Otherwise, return the error.
+template <typename T>
+android::base::Result<T> verifyAndCast(int32_t value);
+
// Below functions parse VehiclePropValues to the respective User HAL request structs. On success,
// these functions return the User HAL struct. Otherwise, they return the error.
android::base::Result<InitialUserInfoRequest> toInitialUserInfoRequest(
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
index 4f25465..47f0394 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
@@ -40,16 +40,22 @@
virtual void SetUp() override {
wifi_instance_name_ = std::get<0>(GetParam());
supplicant_instance_name_ = std::get<1>(GetParam());
+ isP2pOn_ =
+ testing::deviceSupportsFeature("android.hardware.wifi.direct");
+ // Stop Framework
+ std::system("/system/bin/stop");
stopSupplicant(wifi_instance_name_);
startSupplicantAndWaitForHidlService(wifi_instance_name_,
supplicant_instance_name_);
- isP2pOn_ =
- testing::deviceSupportsFeature("android.hardware.wifi.direct");
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
ASSERT_NE(supplicant_.get(), nullptr);
}
- virtual void TearDown() override { stopSupplicant(wifi_instance_name_); }
+ virtual void TearDown() override {
+ stopSupplicant(wifi_instance_name_);
+ // Start Framework
+ std::system("/system/bin/start");
+ }
protected:
// ISupplicant object used for all tests in this fixture.
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
index 8d6f38d..c333c4f 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
@@ -77,11 +77,13 @@
virtual void SetUp() override {
wifi_instance_name_ = std::get<0>(GetParam());
supplicant_instance_name_ = std::get<1>(GetParam());
+ isP2pOn_ =
+ testing::deviceSupportsFeature("android.hardware.wifi.direct");
+ // Stop Framework
+ std::system("/system/bin/stop");
stopSupplicant(wifi_instance_name_);
startSupplicantAndWaitForHidlService(wifi_instance_name_,
supplicant_instance_name_);
- isP2pOn_ =
- testing::deviceSupportsFeature("android.hardware.wifi.direct");
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
p2p_iface_ = getSupplicantP2pIface(supplicant_);
@@ -91,7 +93,11 @@
memcpy(peer_mac_addr_.data(), kTestPeerMacAddr, peer_mac_addr_.size());
}
- virtual void TearDown() override { stopSupplicant(wifi_instance_name_); }
+ virtual void TearDown() override {
+ stopSupplicant(wifi_instance_name_);
+ // Start Framework
+ std::system("/system/bin/start");
+ }
protected:
bool isP2pOn_ = false;
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
index 089b3cd..ff28754 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -72,11 +72,13 @@
virtual void SetUp() override {
wifi_instance_name_ = std::get<0>(GetParam());
supplicant_instance_name_ = std::get<1>(GetParam());
+ isP2pOn_ =
+ testing::deviceSupportsFeature("android.hardware.wifi.direct");
+ // Stop Framework
+ std::system("/system/bin/stop");
stopSupplicant(wifi_instance_name_);
startSupplicantAndWaitForHidlService(wifi_instance_name_,
supplicant_instance_name_);
- isP2pOn_ =
- testing::deviceSupportsFeature("android.hardware.wifi.direct");
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
sta_iface_ = getSupplicantStaIface(supplicant_);
@@ -85,7 +87,11 @@
memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
}
- virtual void TearDown() override { stopSupplicant(wifi_instance_name_); }
+ virtual void TearDown() override {
+ stopSupplicant(wifi_instance_name_);
+ // Start Framework
+ std::system("/system/bin/start");
+ }
protected:
bool isP2pOn_ = false;
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
index 5467e02..295ebfb 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
@@ -85,11 +85,13 @@
virtual void SetUp() override {
wifi_instance_name_ = std::get<0>(GetParam());
supplicant_instance_name_ = std::get<1>(GetParam());
+ isP2pOn_ =
+ testing::deviceSupportsFeature("android.hardware.wifi.direct");
+ // Stop Framework
+ std::system("/system/bin/stop");
stopSupplicant(wifi_instance_name_);
startSupplicantAndWaitForHidlService(wifi_instance_name_,
supplicant_instance_name_);
- isP2pOn_ =
- testing::deviceSupportsFeature("android.hardware.wifi.direct");
supplicant_ = getSupplicant(supplicant_instance_name_, isP2pOn_);
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
sta_network_ = createSupplicantStaNetwork(supplicant_);
@@ -103,7 +105,11 @@
ssid_.assign(kTestSsidStr, kTestSsidStr + strlen(kTestSsidStr));
}
- virtual void TearDown() override { stopSupplicant(wifi_instance_name_); }
+ virtual void TearDown() override {
+ stopSupplicant(wifi_instance_name_);
+ // Start Framework
+ std::system("/system/bin/start");
+ }
protected:
void removeNetwork() {
diff --git a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h
index 3629882..2104794 100644
--- a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h
+++ b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h
@@ -44,6 +44,8 @@
supplicant_v1_1_instance_name_ = std::get<1>(GetParam());
isP2pOn_ =
testing::deviceSupportsFeature("android.hardware.wifi.direct");
+ // Stop Framework
+ std::system("/system/bin/stop");
stopSupplicant(wifi_v1_0_instance_name_);
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
supplicant_v1_1_instance_name_);
@@ -54,6 +56,8 @@
virtual void TearDown() override {
stopSupplicant(wifi_v1_0_instance_name_);
+ // Start Framework
+ std::system("/system/bin/start");
}
protected:
diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.h b/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.h
index 5ecfdd4..2a432d0 100644
--- a/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.h
+++ b/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.h
@@ -50,6 +50,8 @@
supplicant_v1_2_instance_name_ = std::get<1>(GetParam());
isP2pOn_ =
testing::deviceSupportsFeature("android.hardware.wifi.direct");
+ // Stop Framework
+ std::system("/system/bin/stop");
stopSupplicant(wifi_v1_0_instance_name_);
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
supplicant_v1_2_instance_name_);
@@ -61,6 +63,8 @@
virtual void TearDown() override {
stopSupplicant(wifi_v1_0_instance_name_);
+ // Start Framework
+ std::system("/system/bin/start");
}
protected:
diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_p2p_iface_hidl_test.cpp b/wifi/supplicant/1.2/vts/functional/supplicant_p2p_iface_hidl_test.cpp
index 1eb8eea..cab160b 100644
--- a/wifi/supplicant/1.2/vts/functional/supplicant_p2p_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.2/vts/functional/supplicant_p2p_iface_hidl_test.cpp
@@ -43,7 +43,7 @@
virtual void SetUp() override {
SupplicantHidlTestBase::SetUp();
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
- if (!::testing::deviceSupportsFeature("android.hardware.wifi.direct")) {
+ if (!isP2pOn_) {
GTEST_SKIP() << "Wi-Fi Direct is not supported, skip this test.";
}
p2p_iface_ = getSupplicantP2pIface_1_2(supplicant_);
diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
index 12bd122..011a955 100644
--- a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -63,6 +63,8 @@
supplicant_v1_3_instance_name_ = std::get<1>(GetParam());
isP2pOn_ =
testing::deviceSupportsFeature("android.hardware.wifi.direct");
+ // Stop Framework
+ std::system("/system/bin/stop");
stopSupplicant(wifi_v1_0_instance_name_);
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
@@ -76,6 +78,8 @@
virtual void TearDown() override {
stopSupplicant(wifi_v1_0_instance_name_);
+ // Start Framework
+ std::system("/system/bin/start");
}
int64_t pmkCacheExpirationTimeInSec;
diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_sta_network_hidl_test.cpp
index 25091a5..5f60746 100644
--- a/wifi/supplicant/1.3/vts/functional/supplicant_sta_network_hidl_test.cpp
+++ b/wifi/supplicant/1.3/vts/functional/supplicant_sta_network_hidl_test.cpp
@@ -51,6 +51,8 @@
supplicant_v1_3_instance_name_ = std::get<1>(GetParam());
isP2pOn_ =
testing::deviceSupportsFeature("android.hardware.wifi.direct");
+ // Stop Framework
+ std::system("/system/bin/stop");
stopSupplicant(wifi_v1_0_instance_name_);
startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_,
@@ -66,6 +68,8 @@
virtual void TearDown() override {
stopSupplicant(wifi_v1_0_instance_name_);
+ // Start Framework
+ std::system("/system/bin/start");
}
protected: