Merge "Add corresponding error code to fix vts test" into oc-dr1-dev
diff --git a/audio/2.0/config/audio_policy_configuration.xsd b/audio/2.0/config/audio_policy_configuration.xsd
index 48b9a9b..c94da80 100644
--- a/audio/2.0/config/audio_policy_configuration.xsd
+++ b/audio/2.0/config/audio_policy_configuration.xsd
@@ -188,6 +188,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="gains" type="gains" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:token" use="required"/>
<xs:attribute name="role" type="role" use="required"/>
@@ -199,6 +200,10 @@
<xs:field xpath="samplingRate"/>
<xs:field xpath="channelMasks"/>
</xs:unique>
+ <xs:unique name="mixPortGainUniqueness">
+ <xs:selector xpath="gains/gain"/>
+ <xs:field xpath="@name"/>
+ </xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
@@ -365,16 +370,42 @@
<xs:attribute name="samplingRates" type="samplingRates" use="required"/>
<xs:attribute name="channelMasks" type="channelMask" use="required"/>
</xs:complexType>
+ <xs:simpleType name="gainMode">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="AUDIO_GAIN_MODE_JOINT"/>
+ <xs:enumeration value="AUDIO_GAIN_MODE_CHANNELS"/>
+ <xs:enumeration value="AUDIO_GAIN_MODE_RAMP"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="gains">
+ <xs:sequence>
+ <xs:element name="gain" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:token" use="required"/>
+ <xs:attribute name="mode" type="gainMode" use="required"/>
+ <xs:attribute name="channel_mask" type="channelMask" use="optional"/>
+ <xs:attribute name="minValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="maxValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="defaultValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="stepValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="minRampMs" type="xs:int" use="optional"/>
+ <xs:attribute name="maxRampMs" type="xs:int" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="devicePorts">
<xs:sequence>
<xs:element name="devicePort" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="gains" type="gains" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="tagName" type="xs:token" use="required"/>
<xs:attribute name="type" type="audioDevice" use="required"/>
<xs:attribute name="role" type="role" use="required"/>
+ <xs:attribute name="address" type="xs:string" use="optional"/>
</xs:complexType>
<xs:unique name="devicePortProfileUniqueness">
<xs:selector xpath="profile"/>
@@ -382,6 +413,10 @@
<xs:field xpath="samplingRate"/>
<xs:field xpath="channelMasks"/>
</xs:unique>
+ <xs:unique name="devicePortGainUniqueness">
+ <xs:selector xpath="gains/gain"/>
+ <xs:field xpath="@name"/>
+ </xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index f33adf8..fcd134f 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -923,6 +923,7 @@
status = Status::INTERNAL_ERROR;
} else {
convertToHidl(stream_list, &outStreams);
+ mFirstRequest = true;
}
_hidl_cb(status, outStreams);
@@ -1022,7 +1023,13 @@
if (!converted) {
ALOGE("%s: capture request settings metadata is corrupt!", __FUNCTION__);
- return Status::INTERNAL_ERROR;
+ return Status::ILLEGAL_ARGUMENT;
+ }
+
+ if (mFirstRequest && halRequest.settings == nullptr) {
+ ALOGE("%s: capture request settings must not be null for first request!",
+ __FUNCTION__);
+ return Status::ILLEGAL_ARGUMENT;
}
hidl_vec<buffer_handle_t*> allBufPtrs;
@@ -1031,6 +1038,12 @@
request.inputBuffer.bufferId != 0);
size_t numOutputBufs = request.outputBuffers.size();
size_t numBufs = numOutputBufs + (hasInputBuf ? 1 : 0);
+
+ if (numOutputBufs == 0) {
+ ALOGE("%s: capture request must have at least one output buffer!", __FUNCTION__);
+ return Status::ILLEGAL_ARGUMENT;
+ }
+
status = importRequest(request, allBufPtrs, allFences);
if (status != Status::OK) {
return status;
@@ -1102,6 +1115,7 @@
return Status::INTERNAL_ERROR;
}
+ mFirstRequest = false;
return Status::OK;
}
diff --git a/camera/device/3.2/default/CameraDeviceSession.h b/camera/device/3.2/default/CameraDeviceSession.h
index fb3fc02..2fe189f 100644
--- a/camera/device/3.2/default/CameraDeviceSession.h
+++ b/camera/device/3.2/default/CameraDeviceSession.h
@@ -148,6 +148,7 @@
static HandleImporter sHandleImporter;
bool mInitFail;
+ bool mFirstRequest = false;
common::V1_0::helper::CameraMetadata mDeviceInfo;
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 35df042..3b9d35c 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -132,22 +132,34 @@
const char *kHAL1_0 = "1.0";
bool matchDeviceName(const hidl_string& deviceName,
- const hidl_string &providerType, std::smatch& sm) {
+ const hidl_string &providerType,
+ std::string* deviceVersion,
+ std::string* cameraId) {
::android::String8 pattern;
pattern.appendFormat(kDeviceNameRE, providerType.c_str());
std::regex e(pattern.string());
std::string deviceNameStd(deviceName.c_str());
- return std::regex_match(deviceNameStd, sm, e);
+ std::smatch sm;
+ if (std::regex_match(deviceNameStd, sm, e)) {
+ if (deviceVersion != nullptr) {
+ *deviceVersion = sm[1];
+ }
+ if (cameraId != nullptr) {
+ *cameraId = sm[2];
+ }
+ return true;
+ }
+ return false;
}
int getCameraDeviceVersion(const hidl_string& deviceName,
const hidl_string &providerType) {
- std::smatch sm;
- bool match = matchDeviceName(deviceName, providerType, sm);
+ std::string version;
+ bool match = matchDeviceName(deviceName, providerType, &version, nullptr);
if (!match) {
return -1;
}
- std::string version = sm[1].str();
+
if (version.compare(kHAL3_2) == 0) {
// maybe switched to 3.4 or define the hidl version enumlater
return CAMERA_DEVICE_API_VERSION_3_2;
@@ -2446,7 +2458,8 @@
Stream stream = {streamId, StreamType::OUTPUT,
static_cast<uint32_t> (it.width),
static_cast<uint32_t> (it.height),
- static_cast<PixelFormat> (it.format), 0, 0,
+ static_cast<PixelFormat> (it.format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {stream};
StreamConfiguration config = {streams,
@@ -2495,7 +2508,8 @@
static_cast<uint32_t> (0),
static_cast<uint32_t> (0),
static_cast<PixelFormat> (outputStreams[0].format),
- 0, 0, StreamRotation::ROTATION_0};
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {stream};
StreamConfiguration config = {streams,
StreamConfigurationMode::NORMAL_MODE};
@@ -2510,7 +2524,8 @@
static_cast<uint32_t> (UINT32_MAX),
static_cast<uint32_t> (UINT32_MAX),
static_cast<PixelFormat> (outputStreams[0].format),
- 0, 0, StreamRotation::ROTATION_0};
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
streams[0] = stream;
config = {streams,
StreamConfigurationMode::NORMAL_MODE};
@@ -2525,7 +2540,8 @@
static_cast<uint32_t> (it.width),
static_cast<uint32_t> (it.height),
static_cast<PixelFormat> (UINT32_MAX),
- 0, 0, StreamRotation::ROTATION_0};
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
streams[0] = stream;
config = {streams,
StreamConfigurationMode::NORMAL_MODE};
@@ -2539,7 +2555,8 @@
static_cast<uint32_t> (it.width),
static_cast<uint32_t> (it.height),
static_cast<PixelFormat> (it.format),
- 0, 0, static_cast<StreamRotation> (UINT32_MAX)};
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ static_cast<StreamRotation> (UINT32_MAX)};
streams[0] = stream;
config = {streams,
StreamConfigurationMode::NORMAL_MODE};
@@ -2621,7 +2638,8 @@
Stream outputStream = {streamId++, StreamType::OUTPUT,
static_cast<uint32_t> (outputIter.width),
static_cast<uint32_t> (outputIter.height),
- static_cast<PixelFormat> (outputIter.format), 0, 0,
+ static_cast<PixelFormat> (outputIter.format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {
@@ -2683,12 +2701,14 @@
Stream previewStream = {streamId++, StreamType::OUTPUT,
static_cast<uint32_t> (previewIter.width),
static_cast<uint32_t> (previewIter.height),
- static_cast<PixelFormat> (previewIter.format), 0, 0,
+ static_cast<PixelFormat> (previewIter.format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
StreamRotation::ROTATION_0};
Stream blobStream = {streamId++, StreamType::OUTPUT,
static_cast<uint32_t> (blobIter.width),
static_cast<uint32_t> (blobIter.height),
- static_cast<PixelFormat> (blobIter.format), 0, 0,
+ static_cast<PixelFormat> (blobIter.format),
+ GRALLOC1_CONSUMER_USAGE_CPU_READ, 0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {
previewStream, blobStream};
@@ -2744,7 +2764,8 @@
Stream stream = {streamId, StreamType::OUTPUT,
static_cast<uint32_t> (hfrStream.width),
static_cast<uint32_t> (hfrStream.height),
- static_cast<PixelFormat> (hfrStream.format), 0, 0,
+ static_cast<PixelFormat> (hfrStream.format),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {stream};
StreamConfiguration config = {streams,
@@ -2760,7 +2781,8 @@
stream = {streamId++, StreamType::OUTPUT,
static_cast<uint32_t> (0),
static_cast<uint32_t> (0),
- static_cast<PixelFormat> (hfrStream.format), 0, 0,
+ static_cast<PixelFormat> (hfrStream.format),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
StreamRotation::ROTATION_0};
streams[0] = stream;
config = {streams,
@@ -2775,7 +2797,8 @@
stream = {streamId++, StreamType::OUTPUT,
static_cast<uint32_t> (UINT32_MAX),
static_cast<uint32_t> (UINT32_MAX),
- static_cast<PixelFormat> (hfrStream.format), 0, 0,
+ static_cast<PixelFormat> (hfrStream.format),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
StreamRotation::ROTATION_0};
streams[0] = stream;
config = {streams,
@@ -2789,7 +2812,8 @@
stream = {streamId++, StreamType::OUTPUT,
static_cast<uint32_t> (hfrStream.width),
static_cast<uint32_t> (hfrStream.height),
- static_cast<PixelFormat> (UINT32_MAX), 0, 0,
+ static_cast<PixelFormat> (UINT32_MAX),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
StreamRotation::ROTATION_0};
streams[0] = stream;
config = {streams,
@@ -2847,12 +2871,13 @@
static_cast<uint32_t> (videoIter.width),
static_cast<uint32_t> (videoIter.height),
static_cast<PixelFormat> (videoIter.format),
- 0, 0, StreamRotation::ROTATION_0};
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
+ StreamRotation::ROTATION_0};
Stream blobStream = {streamId++, StreamType::OUTPUT,
static_cast<uint32_t> (blobIter.width),
static_cast<uint32_t> (blobIter.height),
static_cast<PixelFormat> (blobIter.format),
- GRALLOC_USAGE_HW_VIDEO_ENCODER, 0,
+ GRALLOC1_CONSUMER_USAGE_CPU_READ, 0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {
videoStream, blobStream};
@@ -2982,6 +3007,9 @@
//Empty settings should be supported after the first call
//for repeating requests.
request.settings.setToExternal(nullptr, 0, true);
+ // The buffer has been registered to HAL by bufferId, so per
+ // API contract we should send a null handle for this buffer
+ request.outputBuffers[0].buffer = nullptr;
mInflightMap.clear();
inflightReq = {1, false, supportsPartialResults,
partialResultCount, resultQueue};
@@ -3078,7 +3106,7 @@
numRequestProcessed = n;
});
ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::INTERNAL_ERROR, status);
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, status);
ASSERT_EQ(numRequestProcessed, 0u);
ret = session->close();
@@ -3139,7 +3167,7 @@
numRequestProcessed = n;
});
ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::INTERNAL_ERROR, status);
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, status);
ASSERT_EQ(numRequestProcessed, 0u);
ret = session->close();
@@ -3572,7 +3600,7 @@
static_cast<uint32_t> (outputPreviewStreams[0].width),
static_cast<uint32_t> (outputPreviewStreams[0].height),
static_cast<PixelFormat> (outputPreviewStreams[0].format),
- 0, 0, StreamRotation::ROTATION_0};
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0, StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {*previewStream};
StreamConfiguration config = {streams,
StreamConfigurationMode::NORMAL_MODE};
diff --git a/current.txt b/current.txt
index ffec165..2ad1e09 100644
--- a/current.txt
+++ b/current.txt
@@ -219,4 +219,4 @@
c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback
b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types
c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi
-bfcf4856c7b6c66ebc56785ed3e5d181b7be859c2add672497a843b024518737 android.hardware.wifi@1.1::IWifiChip
+b056e1defab4071584214584057d0bc73a613081bf1152590549649d4582c13c android.hardware.wifi@1.1::IWifiChip
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp
index c6ac8a6..36fd7c2 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp
@@ -15,6 +15,7 @@
*/
#include <radio_hidl_hal_utils_v1_1.h>
+#include <vector>
/*
* Test IRadio.setSimCardPower() for the response returned.
@@ -106,4 +107,139 @@
radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
-}
\ No newline at end of file
+}
+
+/*
+ * Test IRadio.setCarrierInfoForImsiEncryption() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_1, setCarrierInfoForImsiEncryption) {
+ int serial = GetRandomSerialNumber();
+ ImsiEncryptionInfo imsiInfo;
+ imsiInfo.mcc = "310";
+ imsiInfo.mnc = "004";
+ imsiInfo.carrierKey = (std::vector<uint8_t>){1, 2, 3, 4, 5, 6};
+ imsiInfo.keyIdentifier = "Test";
+ imsiInfo.expirationTime = 20180101;
+
+ radio_v1_1->setCarrierInfoForImsiEncryption(serial, imsiInfo);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
+ radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+ }
+}
+
+/*
+ * Test IRadio.startKeepalive() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_1, startKeepalive) {
+ std::vector<KeepaliveRequest> requests = {
+ {
+ // Invalid IPv4 source address
+ KeepaliveType::NATT_IPV4,
+ {192, 168, 0 /*, 100*/},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv4 destination address
+ KeepaliveType::NATT_IPV4,
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4, 1, 2, 3, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Keepalive Type
+ static_cast<KeepaliveType>(-1),
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv6 source address
+ KeepaliveType::NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
+ 0xBE, 0xEF, 0xBD},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x88, 0x44},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv6 destination address
+ KeepaliveType::NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
+ 0xBE, 0xEF},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x88,
+ /*0x44*/},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Context ID (cid), this should survive the initial
+ // range checking and fail in the modem data layer
+ KeepaliveType::NATT_IPV4,
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Context ID (cid), this should survive the initial
+ // range checking and fail in the modem data layer
+ KeepaliveType::NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
+ 0xBE, 0xEF},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x88, 0x44},
+ 4500,
+ 20000,
+ 0xBAD,
+ }};
+
+ for (auto req = requests.begin(); req != requests.end(); req++) {
+ int serial = GetRandomSerialNumber();
+ radio_v1_1->startKeepalive(serial, *req);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
+
+ ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+ radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+ }
+}
+
+/*
+ * Test IRadio.stopKeepalive() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_1, stopKeepalive) {
+ int serial = GetRandomSerialNumber();
+
+ radio_v1_1->stopKeepalive(serial, 0xBAD);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
+
+ ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+ radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+}
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
index dd4f1ef..c797e35 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
+++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
@@ -53,6 +53,7 @@
hidl_string imsi;
IccIoResult iccIoResult;
int channelId;
+ KeepaliveStatus keepaliveStatus;
// Sms
SendSmsResult sendSmsResult;
@@ -567,4 +568,4 @@
public:
virtual void SetUp() {}
virtual void TearDown() {}
-};
\ No newline at end of file
+};
diff --git a/radio/1.1/vts/functional/radio_response.cpp b/radio/1.1/vts/functional/radio_response.cpp
index 37b80b1..400ef3c 100644
--- a/radio/1.1/vts/functional/radio_response.cpp
+++ b/radio/1.1/vts/functional/radio_response.cpp
@@ -659,7 +659,9 @@
/* 1.1 Apis */
Return<void> RadioResponse_v1_1::setCarrierInfoForImsiEncryptionResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_1.notify();
return Void();
}
@@ -681,11 +683,16 @@
return Void();
}
-Return<void> RadioResponse_v1_1::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
- const KeepaliveStatus& /*status*/) {
+Return<void> RadioResponse_v1_1::startKeepaliveResponse(const RadioResponseInfo& info,
+ const KeepaliveStatus& status) {
+ rspInfo = info;
+ keepaliveStatus = status;
+ parent_v1_1.notify();
return Void();
}
-Return<void> RadioResponse_v1_1::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_1::stopKeepaliveResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_1.notify();
return Void();
-}
\ No newline at end of file
+}
diff --git a/wifi/1.1/IWifiChip.hal b/wifi/1.1/IWifiChip.hal
index 50cd02d..1af1f71 100644
--- a/wifi/1.1/IWifiChip.hal
+++ b/wifi/1.1/IWifiChip.hal
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 The Android Open Source Project
+ * Copyright 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,24 +44,40 @@
};
/**
- * API to set TX power limit.
- * This is used for meeting SAR requirements while making VOIP calls for
- * example.
- *
- * @param powerInDbm Power level in dBm.
- * @return status WifiStatus of the operation.
- * Possible status codes:
- * |WifiStatusCode.SUCCESS|,
- * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
- * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
- * |WifiStatusCode.NOT_AVAILABLE|,
- * |WifiStatusCode.UNKNOWN|
+ * List of preset wifi radio TX power levels for different scenarios.
+ * The actual power values (typically varies based on the channel,
+ * 802.11 connection type, number of MIMO streams, etc) for each scenario
+ * is defined by the OEM as a BDF file since it varies for each wifi chip
+ * vendor and device.
*/
- setTxPowerLimit(int32_t powerInDbm) generates (WifiStatus status);
+ enum TxPowerScenario : uint32_t {
+ VOICE_CALL = 0,
+ };
/**
- * API to reset TX power limit.
- * This is used to set the power back to default values.
+ * API to select one of the preset TX power scenarios.
+ *
+ * The framework must invoke this method with the appropriate scenario to let
+ * the wifi chip change it's transmitting power levels.
+ * OEM's should define various power profiles for each of the scenarios
+ * above (defined in |TxPowerScenario|).
+ *
+ * @param scenario One of the preselected scenarios defined in
+ * |TxPowerScenario|.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+ * |WifiStatusCode.NOT_AVAILABLE|,
+ * |WifiStatusCode.UNKNOWN|
+ */
+ selectTxPowerScenario(TxPowerScenario scenario) generates (WifiStatus status);
+
+ /**
+ * API to reset TX power levels.
+ * This is used to indicate the end of the previously selected TX power
+ * scenario and let the wifi chip fall back to the default power values.
*
* @return status WifiStatus of the operation.
* Possible status codes:
@@ -71,5 +87,5 @@
* |WifiStatusCode.NOT_AVAILABLE|,
* |WifiStatusCode.UNKNOWN|
*/
- resetTxPowerLimit() generates (WifiStatus status);
+ resetTxPowerScenario() generates (WifiStatus status);
};
diff --git a/wifi/1.1/default/hidl_struct_util.cpp b/wifi/1.1/default/hidl_struct_util.cpp
index 6b93b9e..c53cdc5 100644
--- a/wifi/1.1/default/hidl_struct_util.cpp
+++ b/wifi/1.1/default/hidl_struct_util.cpp
@@ -17,9 +17,6 @@
#include <android-base/logging.h>
#include <utils/SystemClock.h>
-#include <android/hardware/wifi/1.0/IWifiChip.h>
-#include <android/hardware/wifi/1.1/IWifiChip.h>
-
#include "hidl_struct_util.h"
namespace android {
@@ -260,6 +257,15 @@
return true;
}
+legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
+ V1_1::IWifiChip::TxPowerScenario hidl_scenario) {
+ switch (hidl_scenario) {
+ case V1_1::IWifiChip::TxPowerScenario::VOICE_CALL:
+ return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL;
+ };
+ CHECK(false);
+}
+
bool convertLegacyFeaturesToHidlStaCapabilities(
uint32_t legacy_feature_set,
uint32_t legacy_logger_feature_set,
diff --git a/wifi/1.1/default/hidl_struct_util.h b/wifi/1.1/default/hidl_struct_util.h
index 7a840f9..747fd2f 100644
--- a/wifi/1.1/default/hidl_struct_util.h
+++ b/wifi/1.1/default/hidl_struct_util.h
@@ -20,6 +20,8 @@
#include <vector>
#include <android/hardware/wifi/1.0/types.h>
+#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include <android/hardware/wifi/1.1/IWifiChip.h>
#include "wifi_legacy_hal.h"
@@ -51,6 +53,8 @@
bool convertLegacyWakeReasonStatsToHidl(
const legacy_hal::WakeReasonStats& legacy_stats,
WifiDebugHostWakeReasonStats* hidl_stats);
+legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
+ V1_1::IWifiChip::TxPowerScenario hidl_scenario);
// STA iface conversion methods.
bool convertLegacyFeaturesToHidlStaCapabilities(
diff --git a/wifi/1.1/default/wifi_chip.cpp b/wifi/1.1/default/wifi_chip.cpp
index 2beac26..2f40234 100644
--- a/wifi/1.1/default/wifi_chip.cpp
+++ b/wifi/1.1/default/wifi_chip.cpp
@@ -343,20 +343,20 @@
enable);
}
-Return<void> WifiChip::setTxPowerLimit(
- int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) {
+Return<void> WifiChip::selectTxPowerScenario(
+ TxPowerScenario scenario, selectTxPowerScenario_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
- &WifiChip::setTxPowerLimitInternal,
+ &WifiChip::selectTxPowerScenarioInternal,
hidl_status_cb,
- powerInDbm);
+ scenario);
}
-Return<void> WifiChip::resetTxPowerLimit(
- resetTxPowerLimit_cb hidl_status_cb) {
+Return<void> WifiChip::resetTxPowerScenario(
+ resetTxPowerScenario_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
- &WifiChip::resetTxPowerLimitInternal,
+ &WifiChip::resetTxPowerScenarioInternal,
hidl_status_cb);
}
@@ -824,13 +824,14 @@
return createWifiStatusFromLegacyError(legacy_status);
}
-WifiStatus WifiChip::setTxPowerLimitInternal(int32_t powerInDbm) {
- auto legacy_status = legacy_hal_.lock()->setTxPowerLimit(powerInDbm);
+WifiStatus WifiChip::selectTxPowerScenarioInternal(TxPowerScenario scenario) {
+ auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario(
+ hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario));
return createWifiStatusFromLegacyError(legacy_status);
}
-WifiStatus WifiChip::resetTxPowerLimitInternal() {
- auto legacy_status = legacy_hal_.lock()->resetTxPowerLimit();
+WifiStatus WifiChip::resetTxPowerScenarioInternal() {
+ auto legacy_status = legacy_hal_.lock()->resetTxPowerScenario();
return createWifiStatusFromLegacyError(legacy_status);
}
diff --git a/wifi/1.1/default/wifi_chip.h b/wifi/1.1/default/wifi_chip.h
index b7dde50..e88100b 100644
--- a/wifi/1.1/default/wifi_chip.h
+++ b/wifi/1.1/default/wifi_chip.h
@@ -126,9 +126,11 @@
getDebugHostWakeReasonStats_cb hidl_status_cb) override;
Return<void> enableDebugErrorAlerts(
bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override;
- Return<void> setTxPowerLimit(
- int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) override;
- Return<void> resetTxPowerLimit(resetTxPowerLimit_cb hidl_status_cb) override;
+ Return<void> selectTxPowerScenario(
+ TxPowerScenario scenario,
+ selectTxPowerScenario_cb hidl_status_cb) override;
+ Return<void> resetTxPowerScenario(
+ resetTxPowerScenario_cb hidl_status_cb) override;
private:
void invalidateAndRemoveAllIfaces();
@@ -180,8 +182,8 @@
std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
getDebugHostWakeReasonStatsInternal();
WifiStatus enableDebugErrorAlertsInternal(bool enable);
- WifiStatus setTxPowerLimitInternal(int32_t powerInDbm);
- WifiStatus resetTxPowerLimitInternal();
+ WifiStatus selectTxPowerScenarioInternal(TxPowerScenario scenario);
+ WifiStatus resetTxPowerScenarioInternal();
WifiStatus handleChipConfiguration(ChipModeId mode_id);
WifiStatus registerDebugRingBufferCallback();
diff --git a/wifi/1.1/default/wifi_legacy_hal.cpp b/wifi/1.1/default/wifi_legacy_hal.cpp
index 052aafb..7d683d3 100644
--- a/wifi/1.1/default/wifi_legacy_hal.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal.cpp
@@ -752,13 +752,13 @@
oui_internal.data());
}
-wifi_error WifiLegacyHal::setTxPowerLimit(int32_t tx_level_dbm) {
- return global_func_table_.wifi_set_tx_power_limit(wlan_interface_handle_,
- tx_level_dbm);
+wifi_error WifiLegacyHal::selectTxPowerScenario(wifi_power_scenario scenario) {
+ return global_func_table_.wifi_select_tx_power_scenario(
+ wlan_interface_handle_, scenario);
}
-wifi_error WifiLegacyHal::resetTxPowerLimit() {
- return global_func_table_.wifi_reset_tx_power_limit(wlan_interface_handle_);
+wifi_error WifiLegacyHal::resetTxPowerScenario() {
+ return global_func_table_.wifi_reset_tx_power_scenario(wlan_interface_handle_);
}
std::pair<wifi_error, uint32_t> WifiLegacyHal::getLoggerSupportedFeatureSet() {
diff --git a/wifi/1.1/default/wifi_legacy_hal.h b/wifi/1.1/default/wifi_legacy_hal.h
index 8d9144d..caa1bd5 100644
--- a/wifi/1.1/default/wifi_legacy_hal.h
+++ b/wifi/1.1/default/wifi_legacy_hal.h
@@ -205,8 +205,8 @@
uint32_t period_in_ms);
wifi_error stopSendingOffloadedPacket(uint32_t cmd_id);
wifi_error setScanningMacOui(const std::array<uint8_t, 3>& oui);
- wifi_error setTxPowerLimit(int32_t tx_level_dbm);
- wifi_error resetTxPowerLimit();
+ wifi_error selectTxPowerScenario(wifi_power_scenario scenario);
+ wifi_error resetTxPowerScenario();
// Logger/debug functions.
std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet();
wifi_error startPktFateMonitoring();
diff --git a/wifi/1.1/default/wifi_legacy_hal_stubs.cpp b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
index 24ed548..c02e3ba 100644
--- a/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
@@ -132,8 +132,8 @@
populateStubFor(&hal_fn->wifi_get_roaming_capabilities);
populateStubFor(&hal_fn->wifi_enable_firmware_roaming);
populateStubFor(&hal_fn->wifi_configure_roaming);
- populateStubFor(&hal_fn->wifi_set_tx_power_limit);
- populateStubFor(&hal_fn->wifi_reset_tx_power_limit);
+ populateStubFor(&hal_fn->wifi_select_tx_power_scenario);
+ populateStubFor(&hal_fn->wifi_reset_tx_power_scenario);
return true;
}
} // namespace legacy_hal
diff --git a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
index 839b6c4..d3a983c 100644
--- a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
@@ -37,7 +37,8 @@
using ::android::hardware::wifi::V1_0::IWifiStaIface;
namespace {
-constexpr int32_t kFakePowerInDbm = -56;
+constexpr IWifiChip::TxPowerScenario kFakePowerScenario =
+ IWifiChip::TxPowerScenario::VOICE_CALL;
}; //namespace
/**
@@ -66,12 +67,12 @@
};
/*
- * SetTxPowerLimit
+ * SelectTxPowerScenario
*/
-TEST_F(WifiChipHidlTest, SetTxPowerLimit) {
+TEST_F(WifiChipHidlTest, SelectTxPowerScenario) {
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
const auto& status =
- HIDL_INVOKE(wifi_chip_, setTxPowerLimit, kFakePowerInDbm);
+ HIDL_INVOKE(wifi_chip_, selectTxPowerScenario, kFakePowerScenario);
if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) {
EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
} else {
@@ -80,12 +81,12 @@
}
/*
- * SetTxPowerLimit
+ * ResetTxPowerScenario
*/
-TEST_F(WifiChipHidlTest, ResetTxPowerLimit) {
+TEST_F(WifiChipHidlTest, ResetTxPowerScenario) {
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
const auto& status =
- HIDL_INVOKE(wifi_chip_, resetTxPowerLimit);
+ HIDL_INVOKE(wifi_chip_, resetTxPowerScenario);
if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) {
EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
} else {
diff --git a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
index 55f5a87..90c36dd 100644
--- a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
+++ b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
@@ -32,6 +32,8 @@
using ::android::hardware::wifi::offload::V1_0::IOffloadCallback;
using ::android::hardware::wifi::offload::V1_0::ScanResult;
using ::android::hardware::wifi::offload::V1_0::ScanParam;
+using ::android::hardware::wifi::offload::V1_0::Ssid;
+using ::android::hardware::wifi::offload::V1_0::NetworkInfo;
using ::android::hardware::wifi::offload::V1_0::ScanFilter;
using ::android::hardware::wifi::offload::V1_0::ScanStats;
using ::android::hardware::wifi::offload::V1_0::OffloadStatus;
@@ -45,7 +47,8 @@
constexpr char kOffloadCallbackSendError[] = "onError";
namespace {
-const uint8_t kSsid[] = {'G', 'o', 'o', 'g', 'l', 'e'};
+const uint8_t kSsid1[] = {'G', 'o', 'o', 'g', 'l', 'e'};
+const uint8_t kSsid2[] = {'X', 'f', 'i', 'n', 'i', 't', 'y'};
const uint8_t kBssid[6] = {0x12, 0xef, 0xa1, 0x2c, 0x97, 0x8b};
const int16_t kRssi = -60;
const uint32_t kFrequency = 2412;
@@ -53,6 +56,10 @@
const uint64_t kTsf = 0;
const uint16_t kCapability = 0;
const uint8_t kNetworkFlags = 0;
+const uint32_t kFrequency1 = 2412;
+const uint32_t kFrequency2 = 2437;
+const uint32_t kDisconnectedModeScanIntervalMs = 5000;
+const int16_t kRssiThreshold = -76;
}
class OffloadCallbackArgs {
@@ -133,7 +140,28 @@
*/
TEST_F(WifiOffloadHidlTest, configureScans) {
ScanParam* pScanParam = new ScanParam();
+ std::vector<uint32_t> frequencyList = {kFrequency1, kFrequency2};
+ pScanParam->disconnectedModeScanIntervalMs =
+ kDisconnectedModeScanIntervalMs;
+ pScanParam->frequencyList = frequencyList;
+ std::vector<Ssid> ssidList;
+ std::vector<std::vector<uint8_t>> ssids{kSsid1, kSsid2};
+ for (const auto& ssid : ssids) {
+ Ssid tmp = ssid;
+ ssidList.push_back(tmp);
+ }
+ pScanParam->ssidList = ssidList;
ScanFilter* pScanFilter = new ScanFilter();
+ pScanFilter->rssiThreshold = kRssiThreshold;
+ std::vector<std::vector<uint8_t>> match_ssids{kSsid1, kSsid2};
+ std::vector<uint8_t> security_flags{kNetworkFlags, kNetworkFlags};
+ std::vector<NetworkInfo> preferredNetworksList;
+ for (size_t i = 0; i < security_flags.size(); i++) {
+ NetworkInfo nwInfo;
+ nwInfo.ssid = match_ssids[i];
+ nwInfo.flags = security_flags[i];
+ preferredNetworksList.push_back(nwInfo);
+ }
const auto& result =
HIDL_INVOKE(wifi_offload_, configureScans, *pScanParam, *pScanFilter);
ASSERT_EQ(OffloadStatusCode::OK, result.code);
@@ -154,7 +182,7 @@
TEST_F(WifiOffloadHidlTest, getScanResults) {
wifi_offload_->setEventCallback(wifi_offload_cb_);
std::vector<ScanResult> scan_results;
- std::vector<uint8_t> ssid(kSsid, kSsid + sizeof(kSsid));
+ std::vector<uint8_t> ssid(kSsid1, kSsid1 + sizeof(kSsid1));
ScanResult scan_result;
scan_result.tsf = kTsf;
scan_result.rssi = kRssi;