Fix for build without a hardware camera.
Change-Id: Ib5a0b58ea9e02ae1df9d258de541726189147567
This commit is contained in:
@@ -1,27 +1,16 @@
|
|||||||
LOCAL_PATH:= $(call my-dir)
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
|
||||||
# Set USE_CAMERA_STUB if you want to use the fake camera.
|
# Set USE_CAMERA_STUB if you don't want to use the hardware camera.
|
||||||
# Set USE_CAMERA_HARDWARE if you want to use the hardware camera.
|
|
||||||
# For emulator or simulator builds, we use the fake camera only by default.
|
|
||||||
|
|
||||||
ifneq ($(filter sooner generic sim,$(TARGET_DEVICE)),)
|
|
||||||
ifeq ($(USE_CAMERA_STUB),)
|
|
||||||
USE_CAMERA_STUB:=true
|
|
||||||
endif
|
|
||||||
ifeq ($(USE_CAMERA_HARDWARE),)
|
|
||||||
USE_CAMERA_HARDWARE:=false
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
# force USE_CAMERA_STUB for testing temporarily
|
|
||||||
# ifeq ($(USE_CAMERA_STUB),)
|
|
||||||
USE_CAMERA_STUB:=true
|
|
||||||
# endif
|
|
||||||
ifeq ($(USE_CAMERA_HARDWARE),)
|
|
||||||
USE_CAMERA_HARDWARE:=true
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(USE_CAMERA_STUB),true)
|
ifeq ($(USE_CAMERA_STUB),true)
|
||||||
|
INCLUDE_CAMERA_STUB:=true
|
||||||
|
INCLUDE_CAMERA_HARDWARE:=false
|
||||||
|
else
|
||||||
|
INCLUDE_CAMERA_STUB:=true # set this to true temporarily for testing
|
||||||
|
INCLUDE_CAMERA_HARDWARE:=true
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(INCLUDE_CAMERA_STUB),true)
|
||||||
#
|
#
|
||||||
# libcamerastub
|
# libcamerastub
|
||||||
#
|
#
|
||||||
@@ -41,7 +30,7 @@ endif
|
|||||||
LOCAL_SHARED_LIBRARIES:= libui
|
LOCAL_SHARED_LIBRARIES:= libui
|
||||||
|
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
endif # USE_CAMERA_STUB
|
endif # INCLUDE_CAMERA_STUB
|
||||||
|
|
||||||
#
|
#
|
||||||
# libcameraservice
|
# libcameraservice
|
||||||
@@ -67,13 +56,13 @@ ifeq ($(TARGET_SIMULATOR),true)
|
|||||||
LOCAL_CFLAGS += -DSINGLE_PROCESS
|
LOCAL_CFLAGS += -DSINGLE_PROCESS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_CAMERA_STUB), true)
|
ifeq ($(INCLUDE_CAMERA_STUB), true)
|
||||||
LOCAL_STATIC_LIBRARIES += libcamerastub
|
LOCAL_STATIC_LIBRARIES += libcamerastub
|
||||||
LOCAL_CFLAGS += -DUSE_CAMERA_STUB
|
LOCAL_CFLAGS += -DINCLUDE_CAMERA_STUB
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_CAMERA_HARDWARE),true)
|
ifeq ($(INCLUDE_CAMERA_HARDWARE),true)
|
||||||
LOCAL_CFLAGS += -DUSE_CAMERA_HARDWARE
|
LOCAL_CFLAGS += -DINCLUDE_CAMERA_HARDWARE
|
||||||
LOCAL_SHARED_LIBRARIES += libcamera
|
LOCAL_SHARED_LIBRARIES += libcamera
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -37,16 +37,16 @@
|
|||||||
#include <utils/String16.h>
|
#include <utils/String16.h>
|
||||||
|
|
||||||
#include "CameraService.h"
|
#include "CameraService.h"
|
||||||
#ifdef USE_CAMERA_STUB
|
#ifdef INCLUDE_CAMERA_STUB
|
||||||
#include "CameraHardwareStub.h"
|
#include "CameraHardwareStub.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
/* This determines the number of cameras available */
|
/* This determines the number of cameras available */
|
||||||
#if defined(USE_CAMERA_HARDWARE) && defined(USE_CAMERA_STUB)
|
#if defined(INCLUDE_CAMERA_HARDWARE) && defined(INCLUDE_CAMERA_STUB)
|
||||||
#define NUM_CAMERAS 2
|
#define NUM_CAMERAS 2
|
||||||
#elif defined(USE_CAMERA_HARDWARE) || defined(USE_CAMERA_STUB)
|
#elif defined(INCLUDE_CAMERA_HARDWARE) || defined(INCLUDE_CAMERA_STUB)
|
||||||
#define NUM_CAMERAS 1
|
#define NUM_CAMERAS 1
|
||||||
#else
|
#else
|
||||||
#error "Should have at least one camera"
|
#error "Should have at least one camera"
|
||||||
@@ -60,10 +60,10 @@ namespace android {
|
|||||||
/* This defines the "open" function for each camera */
|
/* This defines the "open" function for each camera */
|
||||||
extern "C" typedef sp<CameraHardwareInterface> (*OpenCameraHardwareFunction)();
|
extern "C" typedef sp<CameraHardwareInterface> (*OpenCameraHardwareFunction)();
|
||||||
static OpenCameraHardwareFunction sOpenCameraTable[] = {
|
static OpenCameraHardwareFunction sOpenCameraTable[] = {
|
||||||
#ifdef USE_CAMERA_HARDWARE
|
#ifdef INCLUDE_CAMERA_HARDWARE
|
||||||
&openCameraHardware,
|
&openCameraHardware,
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_CAMERA_STUB
|
#ifdef INCLUDE_CAMERA_STUB
|
||||||
&openCameraHardwareStub,
|
&openCameraHardwareStub,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user