Add 'watch' command to CameraService
Currently there is no way to monitor tags and dump per frame data from
Camera devices without calling dumpsys, which in turn dumps a lot of
unnecessary information.
This CL adds a 'watch' command to CameraService which can be called
through `cmd`. 'watch' provides a path to manage tag monitoring without
dumpsys. 'watch' currently has four functions:
1. start <taglist>: starts mornitoring the provided tags in attached
devices.
2. stop: stop monitoring all tags
3. live: prints monitored information to the terminal live
4. dump: dumps any collected camera traces
This CL adds a function to camera device each for the three tag
monitoring function listed above.
Test: n/a
Bug: 199746421
Change-Id: Ia5ce13f6e50c82085afcc676309cdbffef915a41
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index 1f3d478..67ec150 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -1797,6 +1797,35 @@
return dumpDevice(fd, args);
}
+status_t CameraDeviceClient::startWatchingTags(const String8 &tags, int out) {
+ sp<CameraDeviceBase> device = mDevice;
+ if (!device) {
+ dprintf(out, " Device is detached.");
+ return OK;
+ }
+ device->startWatchingTags(tags);
+ return OK;
+}
+
+status_t CameraDeviceClient::stopWatchingTags(int out) {
+ sp<CameraDeviceBase> device = mDevice;
+ if (!device) {
+ dprintf(out, " Device is detached.");
+ return OK;
+ }
+ device->stopWatchingTags();
+ return OK;
+}
+
+status_t CameraDeviceClient::dumpWatchedEventsToVector(std::vector<std::string> &out) {
+ sp<CameraDeviceBase> device = mDevice;
+ if (!device) {
+ return OK;
+ }
+ device->dumpWatchedEventsToVector(out);
+ return OK;
+}
+
void CameraDeviceClient::notifyError(int32_t errorCode,
const CaptureResultExtras& resultExtras) {
// Thread safe. Don't bother locking.