From 92d885b558d522d111e3a37b552f81b82529545e Mon Sep 17 00:00:00 2001 From: Yin-Chia Yeh Date: Wed, 14 Jun 2017 17:29:47 -0700 Subject: [PATCH] Camera: fix camera_metadata address expectation On 32bits architecture, binder driver might allocate non-8 bytes aligned buffers. Test: compile (problem not reproducible on 64bit SOCs) Bug: 62637461 Change-Id: I8ef2b3ecba783a8d189ebe18733082d32cff4899 --- .../vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index c8e44d3d49..c350e31aea 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -1680,7 +1680,8 @@ TEST_F(CameraHidlTest, getCameraCharacteristics) { ASSERT_EQ(Status::OK, status); const camera_metadata_t* metadata = (camera_metadata_t*) chars.data(); size_t expectedSize = chars.size(); - ASSERT_EQ(0, validate_camera_metadata_structure(metadata, &expectedSize)); + int result = validate_camera_metadata_structure(metadata, &expectedSize); + ASSERT_TRUE(result == 0 || result == CAMERA_METADATA_VALIDATION_SHIFTED); size_t entryCount = get_camera_metadata_entry_count(metadata); // TODO: we can do better than 0 here. Need to check how many required // characteristics keys we've defined. @@ -1997,8 +1998,9 @@ TEST_F(CameraHidlTest, constructDefaultRequestSettings) { const camera_metadata_t* metadata = (camera_metadata_t*) req.data(); size_t expectedSize = req.size(); - ASSERT_EQ(0, validate_camera_metadata_structure( - metadata, &expectedSize)); + int result = validate_camera_metadata_structure( + metadata, &expectedSize); + ASSERT_TRUE(result == 0 || result == CAMERA_METADATA_VALIDATION_SHIFTED); size_t entryCount = get_camera_metadata_entry_count(metadata); // TODO: we can do better than 0 here. Need to check how many required // request keys we've defined for each template