Merge "p2p: skip MAC randomization vts test if not supported" into qt-dev
diff --git a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VmsUtils.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VmsUtils.h
index 7082566..d689e62 100644
--- a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VmsUtils.h
+++ b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VmsUtils.h
@@ -60,6 +60,8 @@
};
struct VmsLayerAndPublisher {
+ VmsLayerAndPublisher(VmsLayer layer, int publisher_id)
+ : layer(layer), publisher_id(publisher_id) {}
VmsLayer layer;
int publisher_id;
};
@@ -107,20 +109,13 @@
// An enum to represent the result of parsing START_SESSION message from the VMS service.
enum VmsSessionStatus {
- // New server session is received if the new client ID is -1 and the new server ID is not an
- // invalid ID.
+ // When a new session is received, the client should acknowledge it with the correct
+ // IDs in the START_SESSION message.
kNewServerSession,
- // Ack to new client session is received if the new client ID is same as the old one and the new
- // server ID is not an invalid ID.
- kAckToNewClientSession,
- // Error codes:
+ // When an acknowledgement it received, the client can start using the connection.
+ kAckToCurrentSession,
// Invalid message with either invalid format or unexpected data.
- kInvalidMessage,
- // Invalid server ID. New ID should always be greater than or equal to max_of(0, current server
- // ID)
- kInvalidServiceId,
- // Invalid client ID. New ID should always be either -1 or the current client ID.
- kInvalidClientId
+ kInvalidMessage
};
// Creates an empty base VMS message with some pre-populated default fields.
@@ -162,12 +157,16 @@
std::unique_ptr<VehiclePropValue> createSubscriptionsRequest();
// Creates a VehiclePropValue containing a message of type VmsMessageType.DATA.
-// Returns a nullptr if the byte string in bytes is empty.
+// Returns a nullptr if the vms_packet string in bytes is empty or if the layer_publisher
+// information in VmsLayerAndPublisher format is missing the later or publisher
+// information.
//
// For example, to build a VehiclePropValue message containing a proto, the caller
-// should convert the proto to a byte string using the SerializeToString proto
-// API, then use this inteface to build the VehicleProperty.
-std::unique_ptr<VehiclePropValue> createDataMessage(const std::string& bytes);
+// should first convert the proto to a byte string (vms_packet) using the
+// SerializeToString proto API. Then, it use this interface to build the VehicleProperty
+// by passing publisher and layer information (layer_publisher) and the vms_packet.
+std::unique_ptr<VehiclePropValue> createDataMessageWithLayerPublisherInfo(
+ const VmsLayerAndPublisher& layer_publisher, const std::string& vms_packet);
// Creates a VehiclePropValue containing a message of type
// VmsMessageType.PUBLISHER_ID_REQUEST with the given publisher information.
@@ -229,7 +228,7 @@
// Takes a start session message, current service ID, current client ID; and returns the type/status
// of the message. It also populates the new service ID with the correct value.
VmsSessionStatus parseStartSessionMessage(const VehiclePropValue& start_session,
- const int service_id, const int client_id,
+ const int current_service_id, const int current_client_id,
int* new_service_id);
} // namespace vms
diff --git a/automotive/vehicle/2.0/default/common/src/VmsUtils.cpp b/automotive/vehicle/2.0/default/common/src/VmsUtils.cpp
index 111f6ea..d346206 100644
--- a/automotive/vehicle/2.0/default/common/src/VmsUtils.cpp
+++ b/automotive/vehicle/2.0/default/common/src/VmsUtils.cpp
@@ -126,10 +126,13 @@
return result;
}
-std::unique_ptr<VehiclePropValue> createDataMessage(const std::string& bytes) {
- auto result = createBaseVmsMessage(kMessageTypeSize);
- result->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::DATA)};
- result->value.bytes = std::vector<uint8_t>(bytes.begin(), bytes.end());
+std::unique_ptr<VehiclePropValue> createDataMessageWithLayerPublisherInfo(
+ const VmsLayerAndPublisher& layer_publisher, const std::string& vms_packet) {
+ auto result = createBaseVmsMessage(kMessageTypeSize + kLayerAndPublisherSize);
+ result->value.int32Values = hidl_vec<int32_t>{
+ toInt(VmsMessageType::DATA), layer_publisher.layer.type, layer_publisher.layer.subtype,
+ layer_publisher.layer.version, layer_publisher.publisher_id};
+ result->value.bytes = std::vector<uint8_t>(vms_packet.begin(), vms_packet.end());
return result;
}
@@ -269,27 +272,28 @@
}
VmsSessionStatus parseStartSessionMessage(const VehiclePropValue& start_session,
- const int service_id, const int client_id,
+ const int current_service_id, const int current_client_id,
int* new_service_id) {
if (isValidVmsMessage(start_session) &&
parseMessageType(start_session) == VmsMessageType::START_SESSION &&
start_session.value.int32Values.size() == kSessionIdsSize + 1) {
*new_service_id = start_session.value.int32Values[1];
const int new_client_id = start_session.value.int32Values[2];
- if (*new_service_id < std::max(0, service_id)) {
- *new_service_id = service_id;
- return VmsSessionStatus::kInvalidServiceId;
- }
- if (new_client_id == -1) {
+ if (new_client_id != current_client_id) {
+ // If the new_client_id = -1, it means the service has newly started.
+ // But if it is not -1 and is different than the current client ID, then
+ // it means that the service did not have the correct client ID. In
+ // both these cases, the client should acknowledge with a START_SESSION
+ // message containing the correct client ID. So here, the status is returned as
+ // kNewServerSession.
return VmsSessionStatus::kNewServerSession;
+ } else {
+ // kAckToCurrentSession is returned if the new client ID is same as the current one.
+ return VmsSessionStatus::kAckToCurrentSession;
}
- if (new_client_id == client_id) {
- return VmsSessionStatus::kAckToNewClientSession;
- }
- *new_service_id = service_id;
- return VmsSessionStatus::kInvalidClientId;
}
- *new_service_id = service_id;
+ // If the message is invalid then persist the old service ID.
+ *new_service_id = current_service_id;
return VmsSessionStatus::kInvalidMessage;
}
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 39fe991..a46de24 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -242,6 +242,17 @@
{.config =
{
+ .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {(int)VehicleUnit::METER_PER_SEC,
+ (int)VehicleUnit::MILES_PER_HOUR,
+ (int)VehicleUnit::KILOMETERS_PER_HOUR},
+ },
+ .initialValue = {.int32Values = {(int)VehicleUnit::KILOMETERS_PER_HOUR}}},
+
+ {.config =
+ {
.prop = toInt(VehicleProperty::INFO_DRIVER_SEAT),
.access = VehiclePropertyAccess::READ,
.changeMode = VehiclePropertyChangeMode::STATIC,
diff --git a/automotive/vehicle/2.0/default/tests/VmsUtils_test.cpp b/automotive/vehicle/2.0/default/tests/VmsUtils_test.cpp
index 2b3efc7..7189212 100644
--- a/automotive/vehicle/2.0/default/tests/VmsUtils_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/VmsUtils_test.cpp
@@ -139,12 +139,23 @@
}
TEST(VmsUtilsTest, dataMessage) {
- std::string bytes = "aaa";
- auto message = createDataMessage(bytes);
+ const std::string bytes = "aaa";
+ const VmsLayerAndPublisher layer_and_publisher(VmsLayer(2, 0, 1), 123);
+ auto message = createDataMessageWithLayerPublisherInfo(layer_and_publisher, bytes);
ASSERT_NE(message, nullptr);
EXPECT_TRUE(isValidVmsMessage(*message));
EXPECT_EQ(message->prop, toInt(VehicleProperty::VEHICLE_MAP_SERVICE));
- EXPECT_EQ(message->value.int32Values.size(), 0x1ul);
+ EXPECT_EQ(message->value.int32Values.size(), 0x5ul);
+ EXPECT_EQ(message->value.int32Values[0], toInt(VmsMessageType::DATA));
+
+ // Layer
+ EXPECT_EQ(message->value.int32Values[1], 2);
+ EXPECT_EQ(message->value.int32Values[2], 0);
+ EXPECT_EQ(message->value.int32Values[3], 1);
+
+ // Publisher ID
+ EXPECT_EQ(message->value.int32Values[4], 123);
+
EXPECT_EQ(parseMessageType(*message), VmsMessageType::DATA);
EXPECT_EQ(message->value.bytes.size(), bytes.size());
EXPECT_EQ(memcmp(message->value.bytes.data(), bytes.data(), bytes.size()), 0);
@@ -164,8 +175,9 @@
}
TEST(VmsUtilsTest, parseDataMessage) {
- std::string bytes = "aaa";
- auto message = createDataMessage(bytes);
+ const std::string bytes = "aaa";
+ const VmsLayerAndPublisher layer_and_publisher(VmsLayer(1, 0, 1), 123);
+ auto message = createDataMessageWithLayerPublisherInfo(layer_and_publisher, bytes);
auto data_str = parseData(*message);
ASSERT_FALSE(data_str.empty());
EXPECT_EQ(data_str, bytes);
@@ -359,25 +371,25 @@
int new_service_id;
message->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::START_SESSION), 123, 456};
EXPECT_EQ(parseStartSessionMessage(*message, -1, 456, &new_service_id),
- VmsSessionStatus::kAckToNewClientSession);
+ VmsSessionStatus::kAckToCurrentSession);
EXPECT_EQ(new_service_id, 123);
}
-TEST(VmsUtilsTest, startSessionClientNewlyStartedWithSameServerId) {
+TEST(VmsUtilsTest, startSessionClientNewlyStartedWithSameServerAndClientId) {
auto message = createBaseVmsMessage(3);
int new_service_id;
message->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::START_SESSION), 123, 456};
EXPECT_EQ(parseStartSessionMessage(*message, 123, 456, &new_service_id),
- VmsSessionStatus::kAckToNewClientSession);
+ VmsSessionStatus::kAckToCurrentSession);
EXPECT_EQ(new_service_id, 123);
}
-TEST(VmsUtilsTest, startSessionClientNewlyStartedEdgeCase) {
+TEST(VmsUtilsTest, startSessionWithZeroAsIds) {
auto message = createBaseVmsMessage(3);
int new_service_id;
message->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::START_SESSION), 0, 0};
EXPECT_EQ(parseStartSessionMessage(*message, 0, 0, &new_service_id),
- VmsSessionStatus::kAckToNewClientSession);
+ VmsSessionStatus::kAckToCurrentSession);
EXPECT_EQ(new_service_id, 0);
}
@@ -386,28 +398,19 @@
int new_service_id;
message->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::START_SESSION), 120, 456};
EXPECT_EQ(parseStartSessionMessage(*message, 123, 456, &new_service_id),
- VmsSessionStatus::kInvalidServiceId);
- EXPECT_EQ(new_service_id, 123);
+ VmsSessionStatus::kAckToCurrentSession);
+ EXPECT_EQ(new_service_id, 120);
}
-TEST(VmsUtilsTest, startSessionInvalidServiceIdEdgeCase) {
+TEST(VmsUtilsTest, startSessionNegativeServerId) {
auto message = createBaseVmsMessage(3);
int new_service_id;
message->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::START_SESSION), -1, 456};
EXPECT_EQ(parseStartSessionMessage(*message, -1, 456, &new_service_id),
- VmsSessionStatus::kInvalidServiceId);
+ VmsSessionStatus::kAckToCurrentSession);
EXPECT_EQ(new_service_id, -1);
}
-TEST(VmsUtilsTest, startSessionInvalidClientId) {
- auto message = createBaseVmsMessage(3);
- int new_service_id;
- message->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::START_SESSION), 123, 457};
- EXPECT_EQ(parseStartSessionMessage(*message, 123, 456, &new_service_id),
- VmsSessionStatus::kInvalidClientId);
- EXPECT_EQ(new_service_id, 123);
-}
-
TEST(VmsUtilsTest, startSessionInvalidMessageFormat) {
auto message = createBaseVmsMessage(2);
int new_service_id;
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 200dd3f..86c2c1e 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -755,7 +755,8 @@
uint32_t *partialResultCount /*out*/,
bool *useHalBufManager /*out*/,
sp<DeviceCb> *cb /*out*/,
- uint32_t streamConfigCounter = 0);
+ uint32_t streamConfigCounter = 0,
+ bool allowUnsupport = false);
void configurePreviewStream(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
@@ -1233,7 +1234,14 @@
}
if (mUseHalBufManager) {
- returnStreamBuffers(results.outputBuffers);
+ // Don't return buffers of bufId 0 (empty buffer)
+ std::vector<StreamBuffer> buffers;
+ for (const auto& sb : results.outputBuffers) {
+ if (sb.bufferId != 0) {
+ buffers.push_back(sb);
+ }
+ }
+ returnStreamBuffers(buffers);
}
return notify;
}
@@ -4048,7 +4056,7 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
- if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_4) {
+ if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_5) {
continue;
}
std::string version, deviceId;
@@ -4120,8 +4128,11 @@
configurePreviewStreams3_4(name, deviceVersion, mProvider, &previewThreshold, physicalIds,
&session3_4, &session3_5, &previewStream, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/, &partialResultCount /*out*/,
- &useHalBufManager /*out*/, &cb /*out*/);
- ASSERT_NE(session3_4, nullptr);
+ &useHalBufManager /*out*/, &cb /*out*/, 0 /*streamConfigCounter*/,
+ true /*allowUnsupport*/);
+ if (session3_5 == nullptr) {
+ continue;
+ }
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet =
@@ -5167,7 +5178,8 @@
uint32_t *partialResultCount /*out*/,
bool *useHalBufManager /*out*/,
sp<DeviceCb> *outCb /*out*/,
- uint32_t streamConfigCounter) {
+ uint32_t streamConfigCounter,
+ bool allowUnsupport) {
ASSERT_NE(nullptr, session3_4);
ASSERT_NE(nullptr, session3_5);
ASSERT_NE(nullptr, halStreamConfig);
@@ -5266,6 +5278,28 @@
});
ASSERT_TRUE(ret.isOk());
+ ASSERT_TRUE(!allowUnsupport || deviceVersion == CAMERA_DEVICE_API_VERSION_3_5);
+ if (allowUnsupport) {
+ sp<device::V3_5::ICameraDevice> cameraDevice3_5;
+ castDevice(device3_x, deviceVersion, &cameraDevice3_5);
+
+ bool supported = false;
+ ret = cameraDevice3_5->isStreamCombinationSupported(config3_4,
+ [&supported](Status s, bool combStatus) {
+ ASSERT_TRUE((Status::OK == s) ||
+ (Status::METHOD_NOT_SUPPORTED == s));
+ if (Status::OK == s) {
+ supported = combStatus;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ // If stream combination is not supported, return null session.
+ if (!supported) {
+ *session3_5 = nullptr;
+ return;
+ }
+ }
+
if (*session3_5 != nullptr) {
config3_5.v3_4 = config3_4;
config3_5.streamConfigCounter = streamConfigCounter;
diff --git a/compatibility_matrices/compatibility_matrix.4.xml b/compatibility_matrices/compatibility_matrix.4.xml
index 7d6fc60..21a0847 100644
--- a/compatibility_matrices/compatibility_matrix.4.xml
+++ b/compatibility_matrices/compatibility_matrix.4.xml
@@ -354,6 +354,10 @@
<instance>slot2</instance>
<instance>slot3</instance>
</interface>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.radio</name>
+ <version>1.2</version>
<interface>
<name>ISap</name>
<instance>slot1</instance>
diff --git a/current.txt b/current.txt
index 6510134..47e7d72 100644
--- a/current.txt
+++ b/current.txt
@@ -546,6 +546,7 @@
08d439c463e4044fa78874037d8e8379aa3cabecde32f08a775897eea5a538af android.hardware.secure_element@1.1::ISecureElement
b53ac9d61c24efb16a2d63a861cef20680f6d57adb244a03b9778c675550628b android.hardware.secure_element@1.1::ISecureElementHalCallback
3702b1c52c0bb3427244618e9e7975c05228bf4ceb8720da7a93603a71cb0368 android.hardware.sensors@2.0::ISensors
+c36670945ea09d92ae90a557147352ed9bd5223f957d347b367c2acb6f94870f android.hardware.sensors@2.0::ISensors # b/135216821
ae5faa38538a9f50eb71eb7f9b998271124d2c64b761cb11c4d820c7732b4ddc android.hardware.sensors@2.0::ISensorsCallback
3a98242a57d0820dacaca0f7db52bec433eae1f21c498763c6f1ece611c3967b android.hardware.sensors@2.0::types
ce4b98211959449361146d4b1e5554dc841ceb4d4577154d7b2fb6d1eb504f76 android.hardware.soundtrigger@2.2::ISoundTriggerHw
diff --git a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/Composer.h b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/Composer.h
index 581dc96..90d9b98 100644
--- a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/Composer.h
+++ b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/Composer.h
@@ -80,7 +80,8 @@
Return<void> createClient(IComposer::createClient_cb hidl_cb) override {
std::unique_lock<std::mutex> lock(mClientMutex);
- if (!waitForClientDestroyedLocked(lock)) {
+ bool destroyed = waitForClientDestroyedLocked(lock);
+ if (!destroyed) {
hidl_cb(Error::NO_RESOURCES, nullptr);
return Void();
}
@@ -108,12 +109,10 @@
// inverted (create and then destroy). Wait for a brief period to
// see if the existing client is destroyed.
ALOGD("waiting for previous client to be destroyed");
- mClientDestroyedCondition.wait_for(
- lock, 1s, [this]() -> bool { return mClient.promote() == nullptr; });
- if (mClient.promote() != nullptr) {
+ mClientDestroyedCondition.wait_for(lock, 1s,
+ [this]() -> bool { return mClient == nullptr; });
+ if (mClient != nullptr) {
ALOGD("previous client was not destroyed");
- } else {
- mClient.clear();
}
}
diff --git a/graphics/composer/2.1/utils/vts/Android.bp b/graphics/composer/2.1/utils/vts/Android.bp
index 846cfdf..fcb327f 100644
--- a/graphics/composer/2.1/utils/vts/Android.bp
+++ b/graphics/composer/2.1/utils/vts/Android.bp
@@ -25,6 +25,8 @@
static_libs: [
"VtsHalHidlTargetTestBase",
"android.hardware.graphics.composer@2.1",
+ "android.hardware.graphics.mapper@2.0-vts",
+ "android.hardware.graphics.mapper@3.0-vts",
],
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
diff --git a/graphics/composer/2.1/utils/vts/ComposerVts.cpp b/graphics/composer/2.1/utils/vts/ComposerVts.cpp
index 7ba67d4..c5d5823 100644
--- a/graphics/composer/2.1/utils/vts/ComposerVts.cpp
+++ b/graphics/composer/2.1/utils/vts/ComposerVts.cpp
@@ -315,6 +315,77 @@
writer->reset();
}
+Gralloc::Gralloc() {
+ [this] {
+ ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared<Gralloc3>("default", "default",
+ /*errOnFailure=*/false));
+ if (mGralloc3->getAllocator() == nullptr || mGralloc3->getMapper() == nullptr) {
+ mGralloc3 = nullptr;
+ ASSERT_NO_FATAL_FAILURE(mGralloc2 = std::make_shared<Gralloc2>());
+ }
+ }();
+}
+
+const native_handle_t* Gralloc::allocate(uint32_t width, uint32_t height, uint32_t layerCount,
+ PixelFormat format, uint64_t usage, bool import,
+ uint32_t* outStride) {
+ if (mGralloc3) {
+ IMapper3::BufferDescriptorInfo info{};
+ info.width = width;
+ info.height = height;
+ info.layerCount = layerCount;
+ info.format = static_cast<android::hardware::graphics::common::V1_2::PixelFormat>(format);
+ info.usage = usage;
+ return mGralloc3->allocate(info, import, outStride);
+ } else {
+ IMapper2::BufferDescriptorInfo info{};
+ info.width = width;
+ info.height = height;
+ info.layerCount = layerCount;
+ info.format = format;
+ info.usage = usage;
+ return mGralloc2->allocate(info, import, outStride);
+ }
+}
+
+void* Gralloc::lock(const native_handle_t* bufferHandle, uint64_t cpuUsage,
+ const AccessRegion& accessRegionRect, int acquireFence) {
+ if (mGralloc3) {
+ IMapper3::Rect accessRegion;
+ accessRegion.left = accessRegionRect.left;
+ accessRegion.top = accessRegionRect.top;
+ accessRegion.width = accessRegionRect.width;
+ accessRegion.height = accessRegionRect.height;
+ int32_t bytesPerPixel;
+ int32_t bytesPerStride;
+ return mGralloc3->lock(bufferHandle, cpuUsage, accessRegion, acquireFence, &bytesPerPixel,
+ &bytesPerStride);
+ } else {
+ IMapper2::Rect accessRegion;
+ accessRegion.left = accessRegionRect.left;
+ accessRegion.top = accessRegionRect.top;
+ accessRegion.width = accessRegionRect.width;
+ accessRegion.height = accessRegionRect.height;
+ return mGralloc2->lock(bufferHandle, cpuUsage, accessRegion, acquireFence);
+ }
+}
+
+int Gralloc::unlock(const native_handle_t* bufferHandle) {
+ if (mGralloc3) {
+ return mGralloc3->unlock(bufferHandle);
+ } else {
+ return mGralloc2->unlock(bufferHandle);
+ }
+}
+
+void Gralloc::freeBuffer(const native_handle_t* bufferHandle) {
+ if (mGralloc3) {
+ mGralloc3->freeBuffer(bufferHandle);
+ } else {
+ mGralloc2->freeBuffer(bufferHandle);
+ }
+}
+
} // namespace vts
} // namespace V2_1
} // namespace composer
diff --git a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h
index c97be76..7811048 100644
--- a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h
+++ b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h
@@ -25,8 +25,12 @@
#include <android/hardware/graphics/composer/2.1/IComposer.h>
#include <composer-command-buffer/2.1/ComposerCommandBuffer.h>
#include <composer-vts/2.1/TestCommandReader.h>
+#include <mapper-vts/2.0/MapperVts.h>
+#include <mapper-vts/3.0/MapperVts.h>
#include <utils/StrongPointer.h>
+#include "gtest/gtest.h"
+
namespace android {
namespace hardware {
namespace graphics {
@@ -38,6 +42,10 @@
using android::hardware::graphics::common::V1_0::Dataspace;
using android::hardware::graphics::common::V1_0::Hdr;
using android::hardware::graphics::common::V1_0::PixelFormat;
+using IMapper2 = android::hardware::graphics::mapper::V2_0::IMapper;
+using IMapper3 = android::hardware::graphics::mapper::V3_0::IMapper;
+using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc;
+using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc;
class ComposerClient;
@@ -119,6 +127,34 @@
const sp<IComposerClient> mClient;
};
+class AccessRegion {
+ public:
+ int32_t left;
+ int32_t top;
+ int32_t width;
+ int32_t height;
+};
+
+class Gralloc {
+ public:
+ explicit Gralloc();
+
+ const native_handle_t* allocate(uint32_t width, uint32_t height, uint32_t layerCount,
+ PixelFormat format, uint64_t usage, bool import = true,
+ uint32_t* outStride = nullptr);
+
+ void* lock(const native_handle_t* bufferHandle, uint64_t cpuUsage,
+ const AccessRegion& accessRegionRect, int acquireFence);
+
+ int unlock(const native_handle_t* bufferHandle);
+
+ void freeBuffer(const native_handle_t* bufferHandle);
+
+ protected:
+ std::shared_ptr<Gralloc2> mGralloc2 = nullptr;
+ std::shared_ptr<Gralloc3> mGralloc3 = nullptr;
+};
+
} // namespace vts
} // namespace V2_1
} // namespace composer
diff --git a/graphics/composer/2.1/vts/functional/Android.bp b/graphics/composer/2.1/vts/functional/Android.bp
index c98cc0d..d54da60 100644
--- a/graphics/composer/2.1/vts/functional/Android.bp
+++ b/graphics/composer/2.1/vts/functional/Android.bp
@@ -26,10 +26,13 @@
],
static_libs: [
"android.hardware.graphics.allocator@2.0",
+ "android.hardware.graphics.allocator@3.0",
"android.hardware.graphics.composer@2.1",
"android.hardware.graphics.composer@2.1-vts",
"android.hardware.graphics.mapper@2.0",
"android.hardware.graphics.mapper@2.0-vts",
+ "android.hardware.graphics.mapper@3.0",
+ "android.hardware.graphics.mapper@3.0-vts",
],
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp
index 3c408b7..30b9694 100644
--- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp
+++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp
@@ -21,6 +21,7 @@
#include <composer-vts/2.1/GraphicsComposerCallback.h>
#include <composer-vts/2.1/TestCommandReader.h>
#include <mapper-vts/2.0/MapperVts.h>
+#include <mapper-vts/3.0/MapperVts.h>
#include <VtsHalHidlTargetTestBase.h>
#include <VtsHalHidlTargetTestEnvBase.h>
@@ -47,8 +48,6 @@
using android::hardware::graphics::common::V1_0::Dataspace;
using android::hardware::graphics::common::V1_0::PixelFormat;
using android::hardware::graphics::common::V1_0::Transform;
-using android::hardware::graphics::mapper::V2_0::IMapper;
-using android::hardware::graphics::mapper::V2_0::vts::Gralloc;
using GrallocError = android::hardware::graphics::mapper::V2_0::Error;
// Test environment for graphics.composer
@@ -669,7 +668,6 @@
ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::SetUp());
ASSERT_NO_FATAL_FAILURE(mGralloc = std::make_unique<Gralloc>());
-
Config activeConfig = mComposerClient->getActiveConfig(mPrimaryDisplay);
mDisplayWidth = mComposerClient->getDisplayAttribute(mPrimaryDisplay, activeConfig,
IComposerClient::Attribute::WIDTH);
@@ -685,16 +683,10 @@
}
const native_handle_t* allocate() {
- IMapper::BufferDescriptorInfo info{};
- info.width = mDisplayWidth;
- info.height = mDisplayHeight;
- info.layerCount = 1;
- info.format = PixelFormat::RGBA_8888;
- info.usage =
- static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN |
- BufferUsage::COMPOSER_OVERLAY);
-
- return mGralloc->allocate(info);
+ uint64_t usage =
+ static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN |
+ BufferUsage::COMPOSER_OVERLAY);
+ return mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888, usage);
}
void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); }
@@ -705,7 +697,7 @@
int32_t mDisplayHeight;
private:
- std::unique_ptr<Gralloc> mGralloc;
+ std::unique_ptr<Gralloc> mGralloc;
};
/**
diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp
index c6b524d..dd979cb 100644
--- a/graphics/composer/2.2/utils/vts/Android.bp
+++ b/graphics/composer/2.2/utils/vts/Android.bp
@@ -25,6 +25,10 @@
"android.hardware.graphics.composer@2.1",
"android.hardware.graphics.composer@2.1-vts",
"android.hardware.graphics.composer@2.2",
+ "android.hardware.graphics.mapper@2.1",
+ "android.hardware.graphics.mapper@2.1-vts",
+ "android.hardware.graphics.mapper@3.0",
+ "android.hardware.graphics.mapper@3.0-vts",
],
export_static_lib_headers: [
"android.hardware.graphics.composer@2.1-vts",
diff --git a/graphics/composer/2.2/utils/vts/ComposerVts.cpp b/graphics/composer/2.2/utils/vts/ComposerVts.cpp
index da99460..cd6772a 100644
--- a/graphics/composer/2.2/utils/vts/ComposerVts.cpp
+++ b/graphics/composer/2.2/utils/vts/ComposerVts.cpp
@@ -180,6 +180,48 @@
return matrix;
}
+Gralloc::Gralloc() {
+ [this] {
+ ALOGD("Attempting to initialize gralloc3");
+ ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared<Gralloc3>("default", "default",
+ /*errOnFailure=*/false));
+ if (mGralloc3->getMapper() == nullptr || mGralloc3->getAllocator() == nullptr) {
+ mGralloc3 = nullptr;
+ ALOGD("Failed to create gralloc3, initializing gralloc2_1");
+ mGralloc2_1 = std::make_shared<Gralloc2_1>(/*errOnFailure*/ false);
+ if (!mGralloc2_1->getMapper()) {
+ mGralloc2_1 = nullptr;
+ ALOGD("Failed to create gralloc2_1, initializing gralloc2");
+ ASSERT_NO_FATAL_FAILURE(mGralloc2 = std::make_shared<Gralloc2>());
+ }
+ }
+ }();
+}
+
+bool Gralloc::validateBufferSize(const native_handle_t* bufferHandle, uint32_t width,
+ uint32_t height, uint32_t layerCount, PixelFormat format,
+ uint64_t usage, uint32_t stride) {
+ if (mGralloc3) {
+ IMapper3::BufferDescriptorInfo info{};
+ info.width = width;
+ info.height = height;
+ info.layerCount = layerCount;
+ info.format = static_cast<android::hardware::graphics::common::V1_2::PixelFormat>(format);
+ info.usage = usage;
+ return mGralloc3->validateBufferSize(bufferHandle, info, stride);
+ } else if (mGralloc2_1) {
+ IMapper2_1::BufferDescriptorInfo info{};
+ info.width = width;
+ info.height = height;
+ info.layerCount = layerCount;
+ info.format = static_cast<android::hardware::graphics::common::V1_1::PixelFormat>(format);
+ info.usage = usage;
+ return mGralloc2_1->validateBufferSize(bufferHandle, info, stride);
+ } else {
+ return true;
+ }
+}
+
} // namespace vts
} // namespace V2_2
} // namespace composer
diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h
index 2633021..8fa9b7b 100644
--- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h
+++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h
@@ -27,6 +27,7 @@
#include <android/hardware/graphics/composer/2.2/IComposerClient.h>
#include <composer-command-buffer/2.2/ComposerCommandBuffer.h>
#include <composer-vts/2.1/ComposerVts.h>
+#include <mapper-vts/2.1/MapperVts.h>
#include <utils/StrongPointer.h>
namespace android {
@@ -41,6 +42,11 @@
using common::V1_1::Dataspace;
using common::V1_1::PixelFormat;
using common::V1_1::RenderIntent;
+using IMapper2_1 = android::hardware::graphics::mapper::V2_1::IMapper;
+using IMapper3 = android::hardware::graphics::mapper::V3_0::IMapper;
+using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc;
+using Gralloc2_1 = android::hardware::graphics::mapper::V2_1::vts::Gralloc;
+using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc;
class ComposerClient;
@@ -84,6 +90,26 @@
const sp<IComposerClient> mClient;
};
+class Gralloc : public V2_1::vts::Gralloc {
+ public:
+ Gralloc();
+ const native_handle_t* allocate(uint32_t width, uint32_t height, uint32_t layerCount,
+ PixelFormat format, uint64_t usage, bool import = true,
+ uint32_t* outStride = nullptr) {
+ return V2_1::vts::Gralloc::allocate(
+ width, height, layerCount,
+ static_cast<android::hardware::graphics::common::V1_0::PixelFormat>(format), usage,
+ import, outStride);
+ }
+
+ bool validateBufferSize(const native_handle_t* bufferHandle, uint32_t width, uint32_t height,
+ uint32_t layerCount, PixelFormat format, uint64_t usage,
+ uint32_t stride);
+
+ protected:
+ std::shared_ptr<Gralloc2_1> mGralloc2_1 = nullptr;
+};
+
} // namespace vts
} // namespace V2_2
} // namespace composer
diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp
index 4cb0bdf..9f7e1cd 100644
--- a/graphics/composer/2.2/vts/functional/Android.bp
+++ b/graphics/composer/2.2/vts/functional/Android.bp
@@ -31,6 +31,7 @@
],
static_libs: [
"android.hardware.graphics.allocator@2.0",
+ "android.hardware.graphics.allocator@3.0",
"android.hardware.graphics.common@1.1",
"android.hardware.graphics.composer@2.1",
"android.hardware.graphics.composer@2.1-vts",
@@ -40,6 +41,8 @@
"android.hardware.graphics.mapper@2.0-vts",
"android.hardware.graphics.mapper@2.1",
"android.hardware.graphics.mapper@2.1-vts",
+ "android.hardware.graphics.mapper@3.0",
+ "android.hardware.graphics.mapper@3.0-vts",
],
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp
index da8858e..0648b34 100644
--- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp
+++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp
@@ -39,9 +39,9 @@
using common::V1_1::Dataspace;
using common::V1_1::PixelFormat;
using mapper::V2_1::IMapper;
-using mapper::V2_1::vts::Gralloc;
using V2_1::Display;
using V2_1::Layer;
+using V2_1::vts::AccessRegion;
using V2_1::vts::TestCommandReader;
static const IComposerClient::Color BLACK = {0, 0, 0, 0xff};
@@ -296,14 +296,13 @@
mComposerClient = client;
mGralloc = gralloc;
- mPixelFormat = pixelFormat;
+ mFormat = pixelFormat;
mDataspace = dataspace;
- mInfo.width = width;
- mInfo.height = height;
- mInfo.layerCount = 1;
- mInfo.format = mPixelFormat;
- mInfo.usage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::GPU_TEXTURE);
+ mWidth = width;
+ mHeight = height;
+ mLayerCount = 1;
+ mUsage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::GPU_TEXTURE);
mAccessRegion.top = 0;
mAccessRegion.left = 0;
@@ -322,8 +321,10 @@
mGralloc->freeBuffer(mBufferHandle);
mBufferHandle = nullptr;
}
- mBufferHandle = mGralloc->allocate(mInfo, /*import*/ true, &mStride);
- ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle, mInfo, mStride));
+ mBufferHandle = mGralloc->allocate(mWidth, mHeight, mLayerCount, mFormat, mUsage,
+ /*import*/ true, &mStride);
+ ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle, mWidth, mHeight, mLayerCount,
+ mFormat, mUsage, mStride));
ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer(mDisplay, mBufferHandle, -1));
}
@@ -332,13 +333,13 @@
int32_t fenceHandle;
ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mDisplay, &fenceHandle));
- void* bufData = mGralloc->lock(mBufferHandle, mInfo.usage, mAccessRegion, fenceHandle);
- ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888);
- int32_t bytesPerPixel = GraphicsComposerReadbackTest::GetBytesPerPixel(mPixelFormat);
+ void* bufData = mGralloc->lock(mBufferHandle, mUsage, mAccessRegion, fenceHandle);
+ ASSERT_TRUE(mFormat == PixelFormat::RGB_888 || mFormat == PixelFormat::RGBA_8888);
+ int32_t bytesPerPixel = GraphicsComposerReadbackTest::GetBytesPerPixel(mFormat);
ASSERT_NE(-1, bytesPerPixel);
- for (int row = 0; row < mInfo.height; row++) {
- for (int col = 0; col < mInfo.width; col++) {
- int pixel = row * mInfo.width + col;
+ for (int row = 0; row < mHeight; row++) {
+ for (int col = 0; col < mWidth; col++) {
+ int pixel = row * mWidth + col;
int offset = (row * mStride + col) * bytesPerPixel;
uint8_t* pixelColor = (uint8_t*)bufData + offset;
@@ -354,12 +355,16 @@
}
}
- protected:
- IMapper::BufferDescriptorInfo mInfo;
- IMapper::Rect mAccessRegion;
+ uint32_t mWidth;
+ uint32_t mHeight;
+ uint32_t mLayerCount;
+ PixelFormat mFormat;
+ uint64_t mUsage;
+ AccessRegion mAccessRegion;
+
+ protected:
uint32_t mStride;
const native_handle_t* mBufferHandle = nullptr;
- PixelFormat mPixelFormat;
Dataspace mDataspace;
Display mDisplay;
std::shared_ptr<Gralloc> mGralloc;
@@ -392,13 +397,12 @@
: TestLayer{client, display} {
mGralloc = gralloc;
mComposition = composition;
- mInfo.width = width;
- mInfo.height = height;
- mInfo.layerCount = 1;
- mInfo.format = format;
- mInfo.usage =
- static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
- BufferUsage::COMPOSER_OVERLAY);
+ mWidth = width;
+ mHeight = height;
+ mLayerCount = 1;
+ mFormat = format;
+ mUsage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
+ BufferUsage::COMPOSER_OVERLAY);
mAccessRegion.top = 0;
mAccessRegion.left = 0;
@@ -423,9 +427,9 @@
}
void fillBuffer(std::vector<IComposerClient::Color> expectedColors) {
- void* bufData = mGralloc->lock(mBufferHandle, mInfo.usage, mAccessRegion, -1);
+ void* bufData = mGralloc->lock(mBufferHandle, mUsage, mAccessRegion, -1);
ASSERT_NO_FATAL_FAILURE(GraphicsComposerReadbackTest::fillBuffer(
- mInfo.width, mInfo.height, mStride, bufData, mInfo.format, expectedColors));
+ mWidth, mHeight, mStride, bufData, mFormat, expectedColors));
mFillFence = mGralloc->unlock(mBufferHandle);
if (mFillFence != -1) {
sync_wait(mFillFence, -1);
@@ -437,10 +441,12 @@
mGralloc->freeBuffer(mBufferHandle);
mBufferHandle = nullptr;
}
- mBufferHandle = mGralloc->allocate(mInfo, /*import*/ true, &mStride);
+ mBufferHandle = mGralloc->allocate(mWidth, mHeight, mLayerCount, mFormat, mUsage,
+ /*import*/ true, &mStride);
ASSERT_NE(nullptr, mBufferHandle);
ASSERT_NO_FATAL_FAILURE(fillBuffer(colors));
- ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle, mInfo, mStride));
+ ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle, mWidth, mHeight, mLayerCount,
+ mFormat, mUsage, mStride));
}
void setToClientComposition(const std::shared_ptr<CommandWriterBase>& writer) {
@@ -448,11 +454,15 @@
writer->setLayerCompositionType(IComposerClient::Composition::CLIENT);
}
- IMapper::BufferDescriptorInfo mInfo;
- IMapper::Rect mAccessRegion;
+ AccessRegion mAccessRegion;
uint32_t mStride;
+ uint32_t mWidth;
+ uint32_t mHeight;
+ uint32_t mLayerCount;
+ PixelFormat mFormat;
- protected:
+ protected:
+ uint64_t mUsage;
IComposerClient::Composition mComposition;
std::shared_ptr<Gralloc> mGralloc;
int32_t mFillFence;
@@ -568,14 +578,11 @@
layer->write(mWriter);
// This following buffer call should have no effect
- IMapper::BufferDescriptorInfo bufferInfo{};
- bufferInfo.width = mDisplayWidth;
- bufferInfo.height = mDisplayHeight;
- bufferInfo.layerCount = 1;
- bufferInfo.format = PixelFormat::RGBA_8888;
- bufferInfo.usage =
- static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN);
- const native_handle_t* bufferHandle = mGralloc->allocate(bufferInfo);
+ PixelFormat format = PixelFormat::RGBA_8888;
+ uint64_t usage =
+ static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN);
+ const native_handle_t* bufferHandle =
+ mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, format, usage);
mWriter->setLayerBuffer(0, bufferHandle, -1);
// expected color for each pixel
@@ -642,23 +649,20 @@
// create client target buffer
uint32_t clientStride;
- IMapper::BufferDescriptorInfo clientInfo;
- clientInfo.width = layer->mInfo.width;
- clientInfo.height = layer->mInfo.height;
- clientInfo.layerCount = layer->mInfo.layerCount;
- clientInfo.format = PixelFormat::RGBA_8888;
- clientInfo.usage =
- static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
- BufferUsage::COMPOSER_CLIENT_TARGET);
+ PixelFormat clientFormat = PixelFormat::RGBA_8888;
+ uint64_t clientUsage =
+ static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
+ BufferUsage::COMPOSER_CLIENT_TARGET);
const native_handle_t* clientBufferHandle =
- mGralloc->allocate(clientInfo, /*import*/ true, &clientStride);
+ mGralloc->allocate(layer->mWidth, layer->mHeight, layer->mLayerCount, clientFormat,
+ clientUsage, /*import*/ true, &clientStride);
ASSERT_NE(nullptr, clientBufferHandle);
void* clientBufData =
- mGralloc->lock(clientBufferHandle, clientInfo.usage, layer->mAccessRegion, -1);
+ mGralloc->lock(clientBufferHandle, clientUsage, layer->mAccessRegion, -1);
- ASSERT_NO_FATAL_FAILURE(fillBuffer(clientInfo.width, clientInfo.height, clientStride,
- clientBufData, clientInfo.format, expectedColors));
+ ASSERT_NO_FATAL_FAILURE(fillBuffer(layer->mWidth, layer->mHeight, clientStride,
+ clientBufData, clientFormat, expectedColors));
int clientFence = mGralloc->unlock(clientBufferHandle);
if (clientFence != -1) {
sync_wait(clientFence, -1);
@@ -706,14 +710,13 @@
auto deviceLayer =
std::make_shared<TestBufferLayer>(mComposerClient, mGralloc, mPrimaryDisplay, mDisplayWidth,
mDisplayHeight / 2, PixelFormat::RGBA_8888);
- std::vector<IComposerClient::Color> deviceColors(deviceLayer->mInfo.width *
- deviceLayer->mInfo.height);
- fillColorsArea(deviceColors, deviceLayer->mInfo.width,
- {0, 0, static_cast<int32_t>(deviceLayer->mInfo.width),
- static_cast<int32_t>(deviceLayer->mInfo.height)},
+ std::vector<IComposerClient::Color> deviceColors(deviceLayer->mWidth * deviceLayer->mHeight);
+ fillColorsArea(deviceColors, deviceLayer->mWidth,
+ {0, 0, static_cast<int32_t>(deviceLayer->mWidth),
+ static_cast<int32_t>(deviceLayer->mHeight)},
GREEN);
- deviceLayer->setDisplayFrame({0, 0, static_cast<int32_t>(deviceLayer->mInfo.width),
- static_cast<int32_t>(deviceLayer->mInfo.height)});
+ deviceLayer->setDisplayFrame({0, 0, static_cast<int32_t>(deviceLayer->mWidth),
+ static_cast<int32_t>(deviceLayer->mHeight)});
deviceLayer->setZOrder(10);
ASSERT_NO_FATAL_FAILURE(deviceLayer->setBuffer(deviceColors));
deviceLayer->write(mWriter);
@@ -728,30 +731,25 @@
execute();
ASSERT_EQ(0, mReader->mErrors.size());
- IMapper::BufferDescriptorInfo clientInfo;
- clientInfo.width = mDisplayWidth;
- clientInfo.height = mDisplayHeight;
- clientInfo.layerCount = 1;
- clientInfo.format = PixelFormat::RGBA_8888;
- clientInfo.usage =
- static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
- BufferUsage::COMPOSER_CLIENT_TARGET);
-
+ uint64_t clientUsage =
+ static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
+ BufferUsage::COMPOSER_CLIENT_TARGET);
uint32_t clientStride;
const native_handle_t* clientBufferHandle =
- mGralloc->allocate(clientInfo, /*import*/ true, &clientStride);
+ mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888,
+ clientUsage, /*import*/ true, &clientStride);
ASSERT_NE(nullptr, clientBufferHandle);
- IMapper::Rect clientAccessRegion;
+ AccessRegion clientAccessRegion;
clientAccessRegion.left = 0;
clientAccessRegion.top = 0;
clientAccessRegion.width = mDisplayWidth;
clientAccessRegion.height = mDisplayHeight;
- void* clientData = mGralloc->lock(clientBufferHandle, clientInfo.usage, clientAccessRegion, -1);
- std::vector<IComposerClient::Color> clientColors(clientInfo.width * clientInfo.height);
- fillColorsArea(clientColors, clientInfo.width, clientFrame, RED);
- ASSERT_NO_FATAL_FAILURE(fillBuffer(clientInfo.width, clientInfo.height, clientStride,
- clientData, clientInfo.format, clientColors));
+ void* clientData = mGralloc->lock(clientBufferHandle, clientUsage, clientAccessRegion, -1);
+ std::vector<IComposerClient::Color> clientColors(mDisplayWidth * mDisplayHeight);
+ fillColorsArea(clientColors, mDisplayWidth, clientFrame, RED);
+ ASSERT_NO_FATAL_FAILURE(fillBuffer(mDisplayWidth, mDisplayHeight, clientStride, clientData,
+ PixelFormat::RGBA_8888, clientColors));
int clientFence = mGralloc->unlock(clientBufferHandle);
if (clientFence != -1) {
sync_wait(clientFence, -1);
diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
index 9c80f4d..51832f9 100644
--- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
+++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
@@ -40,7 +40,6 @@
using common::V1_1::PixelFormat;
using common::V1_1::RenderIntent;
using mapper::V2_0::IMapper;
-using mapper::V2_0::vts::Gralloc;
// Test environment for graphics.composer
class GraphicsComposerHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
@@ -171,15 +170,10 @@
}
const native_handle_t* allocate() {
- IMapper::BufferDescriptorInfo info{};
- info.width = 64;
- info.height = 64;
- info.layerCount = 1;
- info.format = static_cast<common::V1_0::PixelFormat>(PixelFormat::RGBA_8888);
- info.usage =
- static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN);
-
- return mGralloc->allocate(info);
+ uint64_t usage =
+ static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN);
+ return mGralloc->allocate(/*width*/ 64, /*height*/ 64, /*layerCount*/ 1,
+ PixelFormat::RGBA_8888, usage);
}
void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); }
@@ -456,18 +450,15 @@
return;
}
- IMapper::BufferDescriptorInfo info{};
- info.width = mDisplayWidth;
- info.height = mDisplayHeight;
- info.layerCount = 1;
- info.format = static_cast<common::V1_0::PixelFormat>(mReadbackPixelFormat);
// BufferUsage::COMPOSER_OUTPUT is missing
- info.usage = static_cast<uint64_t>(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN);
+ uint64_t usage =
+ static_cast<uint64_t>(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN);
std::unique_ptr<Gralloc> gralloc;
const native_handle_t* buffer;
ASSERT_NO_FATAL_FAILURE(gralloc = std::make_unique<Gralloc>());
- ASSERT_NO_FATAL_FAILURE(buffer = gralloc->allocate(info));
+ ASSERT_NO_FATAL_FAILURE(buffer = gralloc->allocate(mDisplayWidth, mDisplayHeight, 1,
+ mReadbackPixelFormat, usage));
mComposerClient->setReadbackBuffer(mPrimaryDisplay, buffer, -1);
}
@@ -483,17 +474,14 @@
return;
}
- IMapper::BufferDescriptorInfo info{};
- info.width = mDisplayWidth;
- info.height = mDisplayHeight;
- info.layerCount = 1;
- info.format = static_cast<common::V1_0::PixelFormat>(mReadbackPixelFormat);
- info.usage = static_cast<uint64_t>(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN);
+ uint64_t usage =
+ static_cast<uint64_t>(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN);
std::unique_ptr<Gralloc> gralloc;
const native_handle_t* buffer;
ASSERT_NO_FATAL_FAILURE(gralloc = std::make_unique<Gralloc>());
- ASSERT_NO_FATAL_FAILURE(buffer = gralloc->allocate(info));
+ ASSERT_NO_FATAL_FAILURE(buffer = gralloc->allocate(mDisplayWidth, mDisplayHeight, 1,
+ mReadbackPixelFormat, usage));
Error error = mComposerClient->getRaw()->setReadbackBuffer(mInvalidDisplayId, buffer, nullptr);
ASSERT_EQ(Error::BAD_DISPLAY, error);
diff --git a/graphics/composer/2.3/utils/vts/Android.bp b/graphics/composer/2.3/utils/vts/Android.bp
index 19438cb..2fe6cd6 100644
--- a/graphics/composer/2.3/utils/vts/Android.bp
+++ b/graphics/composer/2.3/utils/vts/Android.bp
@@ -27,6 +27,12 @@
"android.hardware.graphics.composer@2.2",
"android.hardware.graphics.composer@2.2-vts",
"android.hardware.graphics.composer@2.3",
+ "android.hardware.graphics.mapper@2.0",
+ "android.hardware.graphics.mapper@2.0-vts",
+ "android.hardware.graphics.mapper@2.1",
+ "android.hardware.graphics.mapper@2.1-vts",
+ "android.hardware.graphics.mapper@3.0",
+ "android.hardware.graphics.mapper@3.0-vts",
],
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
diff --git a/graphics/composer/2.3/vts/functional/Android.bp b/graphics/composer/2.3/vts/functional/Android.bp
index ce675ee..2766638 100644
--- a/graphics/composer/2.3/vts/functional/Android.bp
+++ b/graphics/composer/2.3/vts/functional/Android.bp
@@ -28,6 +28,7 @@
],
static_libs: [
"android.hardware.graphics.allocator@2.0",
+ "android.hardware.graphics.allocator@3.0",
"android.hardware.graphics.composer@2.1",
"android.hardware.graphics.composer@2.1-vts",
"android.hardware.graphics.composer@2.2",
@@ -37,6 +38,9 @@
"android.hardware.graphics.mapper@2.0",
"android.hardware.graphics.mapper@2.0-vts",
"android.hardware.graphics.mapper@2.1",
+ "android.hardware.graphics.mapper@2.1-vts",
+ "android.hardware.graphics.mapper@3.0",
+ "android.hardware.graphics.mapper@3.0-vts",
],
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
diff --git a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
index d51c30a..dafe587 100644
--- a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
+++ b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
@@ -41,7 +41,7 @@
using common::V1_2::Dataspace;
using common::V1_2::PixelFormat;
using mapper::V2_0::IMapper;
-using mapper::V2_0::vts::Gralloc;
+using V2_2::vts::Gralloc;
// Test environment for graphics.composer
class GraphicsComposerHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
@@ -156,15 +156,9 @@
}
const native_handle_t* allocate() {
- IMapper::BufferDescriptorInfo info{};
- info.width = 64;
- info.height = 64;
- info.layerCount = 1;
- info.format = static_cast<common::V1_0::PixelFormat>(PixelFormat::RGBA_8888);
- info.usage =
- static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN);
-
- return mGralloc->allocate(info);
+ return mGralloc->allocate(
+ 64, 64, 1, static_cast<common::V1_1::PixelFormat>(PixelFormat::RGBA_8888),
+ static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN));
}
void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); }
diff --git a/graphics/mapper/2.1/utils/vts/MapperVts.cpp b/graphics/mapper/2.1/utils/vts/MapperVts.cpp
index 078068e..36f9cbb 100644
--- a/graphics/mapper/2.1/utils/vts/MapperVts.cpp
+++ b/graphics/mapper/2.1/utils/vts/MapperVts.cpp
@@ -43,24 +43,25 @@
offsetof(IMapper::BufferDescriptorInfo, usage),
"");
-Gralloc::Gralloc() : V2_0::vts::Gralloc() {
+Gralloc::Gralloc(bool errOnFailure) : V2_0::vts::Gralloc() {
if (::testing::Test::HasFatalFailure()) {
return;
}
- init();
+ init(errOnFailure);
}
-Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName)
+Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName,
+ bool errOnFailure)
: V2_0::vts::Gralloc(allocatorServiceName, mapperServiceName) {
if (::testing::Test::HasFatalFailure()) {
return;
}
- init();
+ init(errOnFailure);
}
-void Gralloc::init() {
+void Gralloc::init(bool errOnFailure) {
mMapperV2_1 = IMapper::castFrom(V2_0::vts::Gralloc::getMapper());
- ASSERT_NE(nullptr, mMapperV2_1.get()) << "failed to get mapper 2.1 service";
+ if (errOnFailure) ASSERT_NE(nullptr, mMapperV2_1.get()) << "failed to get mapper 2.1 service";
}
sp<IMapper> Gralloc::getMapper() const {
diff --git a/graphics/mapper/2.1/utils/vts/include/mapper-vts/2.1/MapperVts.h b/graphics/mapper/2.1/utils/vts/include/mapper-vts/2.1/MapperVts.h
index 423d4b3..bc683bb 100644
--- a/graphics/mapper/2.1/utils/vts/include/mapper-vts/2.1/MapperVts.h
+++ b/graphics/mapper/2.1/utils/vts/include/mapper-vts/2.1/MapperVts.h
@@ -32,25 +32,26 @@
// A wrapper to IAllocator and IMapper.
class Gralloc : public V2_0::vts::Gralloc {
public:
- Gralloc();
- Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName);
+ Gralloc(bool errOnFailure = true);
+ Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName,
+ bool errOnFailure = true);
- sp<IMapper> getMapper() const;
+ sp<IMapper> getMapper() const;
- bool validateBufferSize(const native_handle_t* bufferHandle,
- const IMapper::BufferDescriptorInfo& descriptorInfo, uint32_t stride);
- void getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds,
- uint32_t* outNumInts);
+ bool validateBufferSize(const native_handle_t* bufferHandle,
+ const IMapper::BufferDescriptorInfo& descriptorInfo, uint32_t stride);
+ void getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds,
+ uint32_t* outNumInts);
- BufferDescriptor createDescriptor(const IMapper::BufferDescriptorInfo& descriptorInfo);
+ BufferDescriptor createDescriptor(const IMapper::BufferDescriptorInfo& descriptorInfo);
- const native_handle_t* allocate(const IMapper::BufferDescriptorInfo& descriptorInfo,
- bool import = true, uint32_t* outStride = nullptr);
+ const native_handle_t* allocate(const IMapper::BufferDescriptorInfo& descriptorInfo,
+ bool import = true, uint32_t* outStride = nullptr);
protected:
- void init();
+ void init(bool errOnFailure = true);
- sp<IMapper> mMapperV2_1;
+ sp<IMapper> mMapperV2_1;
};
} // namespace vts
diff --git a/graphics/mapper/3.0/utils/vts/MapperVts.cpp b/graphics/mapper/3.0/utils/vts/MapperVts.cpp
index f2b7594..c94e8db 100644
--- a/graphics/mapper/3.0/utils/vts/MapperVts.cpp
+++ b/graphics/mapper/3.0/utils/vts/MapperVts.cpp
@@ -25,8 +25,13 @@
namespace V3_0 {
namespace vts {
-Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName) {
- init(allocatorServiceName, mapperServiceName);
+Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName,
+ bool errOnFailure) {
+ if (errOnFailure) {
+ init(allocatorServiceName, mapperServiceName);
+ } else {
+ initNoErr(allocatorServiceName, mapperServiceName);
+ }
}
void Gralloc::init(const std::string& allocatorServiceName, const std::string& mapperServiceName) {
@@ -38,6 +43,16 @@
ASSERT_FALSE(mMapper->isRemote()) << "mapper is not in passthrough mode";
}
+void Gralloc::initNoErr(const std::string& allocatorServiceName,
+ const std::string& mapperServiceName) {
+ mAllocator = ::testing::VtsHalHidlTargetTestBase::getService<IAllocator>(allocatorServiceName);
+
+ mMapper = ::testing::VtsHalHidlTargetTestBase::getService<IMapper>(mapperServiceName);
+ if (mMapper.get()) {
+ ASSERT_FALSE(mMapper->isRemote()) << "mapper is not in passthrough mode";
+ }
+}
+
Gralloc::~Gralloc() {
for (auto bufferHandle : mClonedBuffers) {
auto buffer = const_cast<native_handle_t*>(bufferHandle);
diff --git a/graphics/mapper/3.0/utils/vts/include/mapper-vts/3.0/MapperVts.h b/graphics/mapper/3.0/utils/vts/include/mapper-vts/3.0/MapperVts.h
index ba79ca4..1141a88 100644
--- a/graphics/mapper/3.0/utils/vts/include/mapper-vts/3.0/MapperVts.h
+++ b/graphics/mapper/3.0/utils/vts/include/mapper-vts/3.0/MapperVts.h
@@ -36,62 +36,66 @@
// A wrapper to IAllocator and IMapper.
class Gralloc {
public:
- Gralloc(const std::string& allocatorServiceName = "default",
- const std::string& mapperServiceName = "default");
- ~Gralloc();
+ Gralloc(const std::string& allocatorServiceName = "default",
+ const std::string& mapperServiceName = "default", bool errOnFailure = true);
+ ~Gralloc();
- // IAllocator methods
+ // IAllocator methods
- sp<IAllocator> getAllocator() const;
+ sp<IAllocator> getAllocator() const;
- std::string dumpDebugInfo();
+ std::string dumpDebugInfo();
- // When import is false, this simply calls IAllocator::allocate. When import
- // is true, the returned buffers are also imported into the mapper.
- //
- // Either case, the returned buffers must be freed with freeBuffer.
- std::vector<const native_handle_t*> allocate(const BufferDescriptor& descriptor, uint32_t count,
- bool import = true, uint32_t* outStride = nullptr);
- const native_handle_t* allocate(const IMapper::BufferDescriptorInfo& descriptorInfo,
- bool import = true, uint32_t* outStride = nullptr);
+ // When import is false, this simply calls IAllocator::allocate. When import
+ // is true, the returned buffers are also imported into the mapper.
+ //
+ // Either case, the returned buffers must be freed with freeBuffer.
+ std::vector<const native_handle_t*> allocate(const BufferDescriptor& descriptor,
+ uint32_t count, bool import = true,
+ uint32_t* outStride = nullptr);
+ const native_handle_t* allocate(const IMapper::BufferDescriptorInfo& descriptorInfo,
+ bool import = true, uint32_t* outStride = nullptr);
- // IMapper methods
+ // IMapper methods
- sp<IMapper> getMapper() const;
+ sp<IMapper> getMapper() const;
- BufferDescriptor createDescriptor(const IMapper::BufferDescriptorInfo& descriptorInfo);
+ BufferDescriptor createDescriptor(const IMapper::BufferDescriptorInfo& descriptorInfo);
- const native_handle_t* importBuffer(const hidl_handle& rawHandle);
- void freeBuffer(const native_handle_t* bufferHandle);
+ const native_handle_t* importBuffer(const hidl_handle& rawHandle);
+ void freeBuffer(const native_handle_t* bufferHandle);
- // We use fd instead of hidl_handle in these functions to pass fences
- // in and out of the mapper. The ownership of the fd is always transferred
- // with each of these functions.
- void* lock(const native_handle_t* bufferHandle, uint64_t cpuUsage,
- const IMapper::Rect& accessRegion, int acquireFence, int32_t* outBytesPerPixel,
- int32_t* outBytesPerStride);
- YCbCrLayout lockYCbCr(const native_handle_t* bufferHandle, uint64_t cpuUsage,
- const IMapper::Rect& accessRegion, int acquireFence);
- int unlock(const native_handle_t* bufferHandle);
+ // We use fd instead of hidl_handle in these functions to pass fences
+ // in and out of the mapper. The ownership of the fd is always transferred
+ // with each of these functions.
+ void* lock(const native_handle_t* bufferHandle, uint64_t cpuUsage,
+ const IMapper::Rect& accessRegion, int acquireFence, int32_t* outBytesPerPixel,
+ int32_t* outBytesPerStride);
+ YCbCrLayout lockYCbCr(const native_handle_t* bufferHandle, uint64_t cpuUsage,
+ const IMapper::Rect& accessRegion, int acquireFence);
+ int unlock(const native_handle_t* bufferHandle);
- bool validateBufferSize(const native_handle_t* bufferHandle,
- const IMapper::BufferDescriptorInfo& descriptorInfo, uint32_t stride);
- void getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds,
- uint32_t* outNumInts);
+ bool validateBufferSize(const native_handle_t* bufferHandle,
+ const IMapper::BufferDescriptorInfo& descriptorInfo, uint32_t stride);
+ void getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds,
+ uint32_t* outNumInts);
- bool isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo);
+ bool isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo);
private:
- void init(const std::string& allocatorServiceName, const std::string& mapperServiceName);
- const native_handle_t* cloneBuffer(const hidl_handle& rawHandle);
+ void init(const std::string& allocatorServiceName, const std::string& mapperServiceName);
- sp<IAllocator> mAllocator;
- sp<IMapper> mMapper;
+ // initialize without checking for failure to get service
+ void initNoErr(const std::string& allocatorServiceName, const std::string& mapperServiceName);
+ const native_handle_t* cloneBuffer(const hidl_handle& rawHandle);
- // Keep track of all cloned and imported handles. When a test fails with
- // ASSERT_*, the destructor will free the handles for the test.
- std::unordered_set<const native_handle_t*> mClonedBuffers;
- std::unordered_set<const native_handle_t*> mImportedBuffers;
+ sp<IAllocator> mAllocator;
+ sp<IMapper> mMapper;
+
+ // Keep track of all cloned and imported handles. When a test fails with
+ // ASSERT_*, the destructor will free the handles for the test.
+ std::unordered_set<const native_handle_t*> mClonedBuffers;
+ std::unordered_set<const native_handle_t*> mImportedBuffers;
};
} // namespace vts
diff --git a/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp b/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp
index 946e5f2..2365124 100644
--- a/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp
+++ b/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp
@@ -35,6 +35,9 @@
// Dev GC timeout. This is the timeout used by vold.
const uint64_t kDevGcTimeoutSec = 120;
const std::chrono::seconds kDevGcTimeout{kDevGcTimeoutSec};
+// Dev GC timeout tolerance. The HAL may not immediately return after the
+// timeout, so include an acceptable tolerance.
+const std::chrono::seconds kDevGcTolerance{3};
// Time accounted for RPC calls.
const std::chrono::milliseconds kRpcTime{1000};
@@ -156,8 +159,9 @@
ASSERT_OK(ret);
// Hold test process because HAL can be single-threaded and doing GC.
- ASSERT_TRUE(ping(kDevGcTimeout + kRpcTime))
- << "Service must be available after " << toString(kDevGcTimeout + kRpcTime);
+ ASSERT_TRUE(ping(kDevGcTimeout + kDevGcTolerance + kRpcTime))
+ << "Service must be available after "
+ << toString(kDevGcTimeout + kDevGcTolerance + kRpcTime);
}
/**
@@ -167,7 +171,7 @@
sp<GcCallback> cb = new GcCallback();
auto ret = fs->garbageCollect(kDevGcTimeoutSec, cb);
ASSERT_OK(ret);
- cb->waitForResult(kDevGcTimeout + kRpcTime, Result::SUCCESS);
+ cb->waitForResult(kDevGcTimeout + kDevGcTolerance + kRpcTime, Result::SUCCESS);
}
} // namespace V1_0
diff --git a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
index a7b6c98..3af1df3 100644
--- a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
+++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
@@ -216,8 +216,8 @@
std::chrono::system_clock::now();
std::chrono::time_point<std::chrono::system_clock> reported_time{
std::chrono::milliseconds(sw_enforced[i].f.dateTime)};
- // The test is flaky for EC keys, so a buffer time of 1 second will be added.
- EXPECT_LE(creation - 1s, reported_time);
+ // The test is flaky for EC keys, so a buffer time of 120 seconds will be added.
+ EXPECT_LE(creation - 120s, reported_time);
EXPECT_LE(reported_time, now + 1s);
}
}
diff --git a/power/stats/1.0/vts/functional/VtsHalPowerStatsV1_0TargetTest.cpp b/power/stats/1.0/vts/functional/VtsHalPowerStatsV1_0TargetTest.cpp
index 9f007e4..835a47b 100644
--- a/power/stats/1.0/vts/functional/VtsHalPowerStatsV1_0TargetTest.cpp
+++ b/power/stats/1.0/vts/functional/VtsHalPowerStatsV1_0TargetTest.cpp
@@ -566,15 +566,16 @@
thread1.join();
}
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(PowerStatsHidlEnv::Instance());
- ::testing::InitGoogleTest(&argc, argv);
- PowerStatsHidlEnv::Instance()->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
- return status;
-}
} // namespace vts
} // namespace stats
} // namespace power
} // namespace android
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(android::power::stats::vts::PowerStatsHidlEnv::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ android::power::stats::vts::PowerStatsHidlEnv::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
index 63d3187..f11f0d8 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
@@ -60,6 +60,11 @@
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED,
RadioError::OPERATION_NOT_ALLOWED}));
}
+
+ if (radioRsp_v1_2->rspInfo.error == RadioError::NONE) {
+ ALOGI("Stop Network Scan");
+ stopNetworkScan();
+ }
}
/*
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
index b34f138..bff7481 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <android/hardware/radio/1.1/IRadio.h>
#include <radio_hidl_hal_utils_v1_2.h>
void RadioHidlTest_v1_2::SetUp() {
@@ -84,4 +85,28 @@
serial = GetRandomSerialNumber();
radio_v1_2->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
-}
\ No newline at end of file
+}
+
+void RadioHidlTest_v1_2::stopNetworkScan() {
+ sp<::android::hardware::radio::V1_1::IRadio> radio_v1_1;
+
+ radio_v1_1 = ::testing::VtsHalHidlTargetTestBase::getService<
+ ::android::hardware::radio::V1_1::IRadio>(
+ RadioHidlEnvironment::Instance()
+ ->getServiceName<::android::hardware::radio::V1_1::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
+ if (radio_v1_1 == NULL) {
+ sleep(60);
+ radio_v1_1 = ::testing::VtsHalHidlTargetTestBase::getService<
+ ::android::hardware::radio::V1_1::IRadio>(
+ RadioHidlEnvironment::Instance()
+ ->getServiceName<::android::hardware::radio::V1_1::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
+ }
+ ASSERT_NE(nullptr, radio_v1_1.get());
+
+ serial = GetRandomSerialNumber();
+
+ radio_v1_1->stopNetworkScan(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+}
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
index 2e65bfb..3f780e5 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
+++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
@@ -622,7 +622,10 @@
/* Update Sim Card Status */
void updateSimCardStatus();
- public:
+ /* Stop Network Scan Command */
+ void stopNetworkScan();
+
+ public:
virtual void SetUp() override;
/* Used as a mechanism to inform the test about data/event callback */
diff --git a/sensors/2.0/ISensors.hal b/sensors/2.0/ISensors.hal
index 3a9af46..a84c56e 100644
--- a/sensors/2.0/ISensors.hal
+++ b/sensors/2.0/ISensors.hal
@@ -99,7 +99,11 @@
* Lock FMQ. When the HAL reads the data from the Wake Lock FMQ, the HAL
* decrements its current count of unprocessed WAKE_UP events and releases
* its wake_lock if the current count of unprocessed WAKE_UP events is
- * zero.
+ * zero. It is important to note that the HAL must acquire the wake lock and
+ * update its internal state regarding the number of outstanding WAKE_UP
+ * events _before_ posting the event to the Wake Lock FMQ, in order to avoid
+ * a race condition that can lead to loss of wake lock synchronization with
+ * the framework.
*
* The framework must use the WakeLockQueueFlagBits::DATA_WRITTEN value to
* notify the HAL that data has been written to the Wake Lock FMQ and must
diff --git a/sensors/2.0/vts/functional/SensorsHidlEnvironmentV2_0.cpp b/sensors/2.0/vts/functional/SensorsHidlEnvironmentV2_0.cpp
index 5f71654..0525bdc 100644
--- a/sensors/2.0/vts/functional/SensorsHidlEnvironmentV2_0.cpp
+++ b/sensors/2.0/vts/functional/SensorsHidlEnvironmentV2_0.cpp
@@ -139,6 +139,7 @@
size_t eventsToRead = std::min(availableEvents, mEventBuffer.size());
if (eventsToRead > 0) {
if (mEventQueue->read(mEventBuffer.data(), eventsToRead)) {
+ mEventQueueFlag->wake(asBaseType(EventQueueFlagBits::EVENTS_READ));
for (size_t i = 0; i < eventsToRead; i++) {
addEvent(mEventBuffer[i]);
}