OSDN Git Service

Reject face detection commands in emulated camera
authorBjoern Johansson <bjoernj@google.com>
Fri, 5 Aug 2016 19:04:11 +0000 (12:04 -0700)
committerBjoern Johansson <bjoernj@google.com>
Wed, 11 Jan 2017 21:03:23 +0000 (13:03 -0800)
The emulated camera does not support hardware face detection. It
indicates this by returning zero for the number of supported faces for
face detection. However when sending commands to the camera to start or
stop face detection it would indicate success. This is not valid
behavior and with this change those commands will now indicate failure.

BUG: 30700822

Test: ran camera CTS tests
Change-Id: I27982b8c850a85cc7f415397eee07c8096a82795
(cherry picked from commit cfd4e6c764c64369247796d3adb7379964a050c0)

camera/EmulatedCamera.cpp

index 707033f..2f8eeae 100755 (executable)
@@ -509,6 +509,13 @@ status_t EmulatedCamera::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
 {
     ALOGV("%s: cmd = %d, arg1 = %d, arg2 = %d", __FUNCTION__, cmd, arg1, arg2);
 
+    switch (cmd) {
+        case CAMERA_CMD_START_FACE_DETECTION:
+        case CAMERA_CMD_STOP_FACE_DETECTION:
+            // We do not support hardware face detection so we need to indicate
+            // that any attempt to start/stop face detection is invalid
+            return BAD_VALUE;
+    }
     /* TODO: Future enhancements. */
     return 0;
 }