Camera3: Remove mutex from ZoomRatioMapper
ZoomRatioMapper's member variables are const after construction. As a
result, we don't need mutex to protect updateCaptureRequest and
updateCaptureResult calls.
Also fixed missing zoom ratio mapping initialization for physical
sub-camera.
Test: testZoomRatio CTS
Bug: 130025314
Change-Id: Ibe2ff7cffb13178dcf70fc9e2eb044184e58bcf2
diff --git a/services/camera/libcameraservice/tests/ZoomRatioTest.cpp b/services/camera/libcameraservice/tests/ZoomRatioTest.cpp
index 1bfa03f..300da09 100644
--- a/services/camera/libcameraservice/tests/ZoomRatioTest.cpp
+++ b/services/camera/libcameraservice/tests/ZoomRatioTest.cpp
@@ -66,7 +66,8 @@
return res;
}
- return m->initZoomRatioTags(&deviceInfo, hasZoomRatioRange, usePreCorrectArray);
+ *m = ZoomRatioMapper(&deviceInfo, hasZoomRatioRange, usePreCorrectArray);
+ return OK;
}
TEST(ZoomRatioTest, Initialization) {
@@ -86,12 +87,12 @@
res = ZoomRatioMapper::overrideZoomRatioTags(&deviceInfo, &supportNativeZoomRatio);
ASSERT_EQ(res, OK);
ASSERT_EQ(supportNativeZoomRatio, false);
- res = mapperNoZoomRange.initZoomRatioTags(&deviceInfo,
+ mapperNoZoomRange = ZoomRatioMapper(&deviceInfo,
supportNativeZoomRatio, true/*usePreCorrectArray*/);
- ASSERT_EQ(res, OK);
- res = mapperNoZoomRange.initZoomRatioTags(&deviceInfo,
+ ASSERT_TRUE(mapperNoZoomRange.isValid());
+ mapperNoZoomRange = ZoomRatioMapper(&deviceInfo,
supportNativeZoomRatio, false/*usePreCorrectArray*/);
- ASSERT_EQ(res, OK);
+ ASSERT_TRUE(mapperNoZoomRange.isValid());
entry = deviceInfo.find(ANDROID_CONTROL_ZOOM_RATIO_RANGE);
ASSERT_EQ(entry.count, 2U);
@@ -120,12 +121,12 @@
ASSERT_EQ(res, OK);
ASSERT_EQ(supportNativeZoomRatio, true);
ZoomRatioMapper mapperWithZoomRange;
- res = mapperWithZoomRange.initZoomRatioTags(&deviceInfo,
+ mapperWithZoomRange = ZoomRatioMapper(&deviceInfo,
supportNativeZoomRatio, true/*usePreCorrectArray*/);
- ASSERT_EQ(res, OK);
- res = mapperWithZoomRange.initZoomRatioTags(&deviceInfo,
+ ASSERT_TRUE(mapperWithZoomRange.isValid());
+ mapperWithZoomRange = ZoomRatioMapper(&deviceInfo,
supportNativeZoomRatio, false/*usePreCorrectArray*/);
- ASSERT_EQ(res, OK);
+ ASSERT_TRUE(mapperWithZoomRange.isValid());
entry = deviceInfo.find(ANDROID_CONTROL_ZOOM_RATIO_RANGE);
ASSERT_EQ(entry.count, 2U);