CameraService: Add option to dump templates to HALv3 devices
Add -t to dumpsys media.camera to dump the request templates of any open
HALv3 camera devices.
Change-Id: Ib2746d5ca4a25e7f8eab842e6a99daa03f15acb8
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index 50d9d75..6220349 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -440,6 +440,15 @@
"Camera %d: %s: Unable to lock main lock, proceeding anyway",
mId, __FUNCTION__);
+ bool dumpTemplates = false;
+ String16 templatesOption("-t");
+ int n = args.size();
+ for (int i = 0; i < n; i++) {
+ if (args[i] == templatesOption) {
+ dumpTemplates = true;
+ }
+ }
+
String8 lines;
const char *status =
@@ -491,6 +500,33 @@
lastRequest.dump(fd, /*verbosity*/2, /*indentation*/6);
}
+ if (dumpTemplates) {
+ const char *templateNames[] = {
+ "TEMPLATE_PREVIEW",
+ "TEMPLATE_STILL_CAPTURE",
+ "TEMPLATE_VIDEO_RECORD",
+ "TEMPLATE_VIDEO_SNAPSHOT",
+ "TEMPLATE_ZERO_SHUTTER_LAG",
+ "TEMPLATE_MANUAL"
+ };
+
+ for (int i = 1; i < CAMERA3_TEMPLATE_COUNT; i++) {
+ const camera_metadata_t *templateRequest;
+ templateRequest =
+ mHal3Device->ops->construct_default_request_settings(
+ mHal3Device, i);
+ lines = String8::format(" HAL Request %s:\n", templateNames[i-1]);
+ if (templateRequest == NULL) {
+ lines.append(" Not supported\n");
+ write(fd, lines.string(), lines.size());
+ } else {
+ write(fd, lines.string(), lines.size());
+ dump_indented_camera_metadata(templateRequest,
+ fd, /*verbosity*/2, /*indentation*/8);
+ }
+ }
+ }
+
if (mHal3Device != NULL) {
lines = String8(" HAL device dump:\n");
write(fd, lines.string(), lines.size());