在发生严重错误时,所有有返回值的HAL相机设备操作函数将返回-ENODEV或NULL。这表示当前设备不能继续运行并应该被框架层关闭。一旦错误被一些方法返回或notify()被使用ERROR_DEVICE参数调用,则只有close()方法能被成功调用,其他方法都将返回-ENODEV或NULL。
Camera HAL device ops functions that have a return value will all return -ENODEV / NULL in case of a serious error. This means the device cannot continue operation, and must be closed by the framework. Once this error is returned by some method, or if notify() is called with ERROR_DEVICE, only the close() method can be called successfully. All other methods will return -ENODEV / NULL.
如果设备被以错误的顺序操作,例如框架层在调用initialize()前调用configure_streams(),设备必须对该调用回-ENOSYS并不做其他任何操作。
If a device op is called in the wrong sequence, for example if the framework calls configure_streams() is called before initialize(), the device must return -ENOSYS from the call, and do nothing.
图像捕获过程中的瞬时错误必须按照如下规则通过notify()报告:
Transient errors in image capture must be reported through notify() as follows:
若整个捕获失败,HAL将通过使用ERROR_REQUEST参数调用notify()进行报告。单独的元数据返回或缓冲区输出错误不会通过该方式报告。
The failure of an entire capture to occur must be reported by the HAL by calling notify() with ERROR_REQUEST. Individual errors for the result metadata or the output buffers must not be reported in this case.
如果无法为捕获生成元数据,但已经有图像缓冲区被填充,HAL将通过使用ERROR_RESULT参数调用notify()进行报告。
If the metadata for a capture cannot be produced, but some image buffers were filled, the HAL must call notify() with ERROR_RESULT.
如果用于输出的图像缓冲区不能被填充,但已经有元数据被生成或某些其他的缓冲区被填充,HAL将对每个失败的缓冲区通过使用ERROR_BUFFER参数调用notify()进行报告。
If an output image buffer could not be filled, but either the metadata was produced or some other buffers were filled, the HAL must call notify() with ERROR_BUFFER for each failed buffer.
HAL必须仍然对每个具有瞬时错误的示例使用有效的输出或输入(如果提交了输入缓冲区)的buffer_handle_t调用process_capture_result。当元数据无法生成时,将其字段设为NULL。如果图像缓冲区不能被填充,则必须携带错误状态通过process_capture_result返回,这些缓冲区的释放栅栏必须被设置为传递给框架层的获取栅栏或是-1栅栏(如果它们已经被HAL等待)。
In each of these transient failure cases, the HAL must still call process_capture_result, with valid output and input (if an input buffer was submitted) buffer_handle_t. If the result metadata could not be produced, it should be NULL. If some buffers could not be filled, they must be returned with process_capture_result in the error state, their release fences must be set to the acquire fences passed by the framework, or -1 if they have been waited on by the HAL already.
使用无效参数调用相应的方法时将会返回-EINVAL。在这种情况下,框架层应该表现得像该方法从未被调用过一样。
Invalid input arguments result in -EINVAL from the appropriate methods. In that case, the framework must act as if that call had never been made.