Correctly checking hw_get_module return status.
Test: Local
Change-Id: I0af12ff73c8c6cfb5cb77932123a0ff66871f598
diff --git a/camera/GrallocModule.h b/camera/GrallocModule.h
index 693be49..1f5a8f2 100644
--- a/camera/GrallocModule.h
+++ b/camera/GrallocModule.h
@@ -1,6 +1,5 @@
-
-#ifndef EMU_CAMERA_GRALLOC_MODULE_
-#define EMU_CAMERA_GRALLOC_MODULE_
+#ifndef EMU_CAMERA_GRALLOC_MODULE_H
+#define EMU_CAMERA_GRALLOC_MODULE_H
#include <hardware/gralloc.h>
@@ -17,11 +16,13 @@
return mModule->lock(mModule, handle, usage, l, t, w, h, vaddr);
}
+#ifdef GRALLOC_MODULE_API_VERSION_0_2
int lock_ycbcr(buffer_handle_t handle,
int usage, int l, int t, int w, int h,
struct android_ycbcr *ycbcr) {
return mModule->lock_ycbcr(mModule, handle, usage, l, t, w, h, ycbcr);
}
+#endif
int unlock(buffer_handle_t handle) {
return mModule->unlock(mModule, handle);
@@ -30,8 +31,9 @@
private:
GrallocModule() {
const hw_module_t *module = NULL;
- if (!hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module)) {
- ALOGE("%s: Failed to get gralloc module", __FUNCTION__);
+ int ret = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
+ if (ret) {
+ ALOGE("%s: Failed to get gralloc module: %d", __FUNCTION__, ret);
}
mModule = reinterpret_cast<const gralloc_module_t*>(module);
}