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