Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30136ce8 authored by Chih-Chung Chang's avatar Chih-Chung Chang Committed by Android Git Automerger
Browse files

am 7768892c: Fix for build without a hardware camera.

parents 025e2744 8476185a
Loading
Loading
Loading
Loading
+13 −24
Original line number Diff line number Diff line
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.
# Set USE_CAMERA_STUB if you don't want to use the hardware camera.

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
ifeq ($(USE_CAMERA_STUB),true)
  INCLUDE_CAMERA_STUB:=true
  INCLUDE_CAMERA_HARDWARE:=false
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
  INCLUDE_CAMERA_STUB:=true  # set this to true temporarily for testing
  INCLUDE_CAMERA_HARDWARE:=true
endif

ifeq ($(USE_CAMERA_STUB),true)
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

+5 −5
Original line number Diff line number Diff line
@@ -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
};