summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/hardware/camera2.h5
-rw-r--r--tests/camera2/camera2.cpp30
2 files changed, 34 insertions, 1 deletions
diff --git a/include/hardware/camera2.h b/include/hardware/camera2.h
index 7f06c52..0764cb1 100644
--- a/include/hardware/camera2.h
+++ b/include/hardware/camera2.h
@@ -400,7 +400,10 @@ enum {
* full-resolution images without compromising preview frame rate. 3A on
* auto.
*/
- CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG
+ CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG,
+
+ /* Total number of templates */
+ CAMERA2_TEMPLATE_COUNT
};
diff --git a/tests/camera2/camera2.cpp b/tests/camera2/camera2.cpp
index cc2face..6c22426 100644
--- a/tests/camera2/camera2.cpp
+++ b/tests/camera2/camera2.cpp
@@ -572,4 +572,34 @@ TEST_F(Camera2Test, CaptureBurstRaw) {
}
}
+TEST_F(Camera2Test, ConstructDefaultRequests) {
+ status_t res;
+
+ for (int id = 0; id < getNumCameras(); id++) {
+ if (!isHal2Supported(id)) continue;
+
+ ASSERT_NO_FATAL_FAILURE(setUpCamera(id));
+
+ for (int i = CAMERA2_TEMPLATE_PREVIEW; i < CAMERA2_TEMPLATE_COUNT;
+ i++) {
+ camera_metadata_t *request = NULL;
+ res = mDevice->ops->construct_default_request(mDevice,
+ i,
+ &request);
+ EXPECT_EQ(NO_ERROR, res) <<
+ "Unable to construct request from template type %d", i;
+ EXPECT_TRUE(request != NULL);
+ EXPECT_LT((size_t)0, get_camera_metadata_entry_count(request));
+ EXPECT_LT((size_t)0, get_camera_metadata_data_count(request));
+
+ IF_ALOGV() {
+ std::cout << " ** Template type " << i << ":"<<std::endl;
+ dump_camera_metadata(request, 0, 2);
+ }
+
+ free_camera_metadata(request);
+ }
+ }
+}
+
} // namespace android