Skip to content

Commit

Permalink
compat: camera: fix compilation with Android 9
Browse files Browse the repository at this point in the history
Change-Id: I643f85380622b5ad93234e644753603aa59c2d77
  • Loading branch information
NotKit committed Jul 9, 2020
1 parent 290eb35 commit 61fec85
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions compat/camera/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ LOCAL_PATH:= $(call my-dir)

HYBRIS_MEDIA_32_BIT_ONLY := $(shell cat frameworks/av/media/libmediaplayerservice/Android.mk |grep LOCAL_32_BIT_ONLY |grep -o "true\|false")

ifeq ($(HYBRIS_MEDIA_32_BIT_ONLY),)
HYBRIS_MEDIA_32_BIT_ONLY := $(shell cat frameworks/av/media/libmediaplayerservice/Android.bp | grep compile_multilib | grep -o "32" | sed "s/32/true/")
endif

ifeq ($(HYBRIS_MEDIA_32_BIT_ONLY),true)
HYBRIS_MEDIA_MULTILIB := 32
endif
Expand All @@ -11,6 +15,8 @@ include $(LOCAL_PATH)/../Android.common.mk

HYBRIS_PATH := $(LOCAL_PATH)/../../hybris

IS_ANDROID_8 := $(shell test $(ANDROID_VERSION_MAJOR) -ge 8 && echo true)

LOCAL_SRC_FILES := camera_compatibility_layer.cpp

LOCAL_MODULE := libcamera_compat_layer
Expand All @@ -19,9 +25,16 @@ LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := \
$(HYBRIS_PATH)/include

ifeq ($(IS_ANDROID_8),true)
LOCAL_CFLAGS += \
-Wno-unused-parameter \
-Wno-unused-variable
endif

LOCAL_SHARED_LIBRARIES := \
libcutils \
libcamera_client \
liblog \
libutils \
libbinder \
libhardware \
Expand Down
6 changes: 6 additions & 0 deletions compat/camera/camera_compatibility_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ void CameraControl::postRecordingFrameHandleTimestamp(nsecs_t /*timestamp*/, nat
REPORT_FUNCTION();
}

void CameraControl::postRecordingFrameHandleTimestampBatch(const std::vector<nsecs_t>& /*timestamps*/,
const std::vector<native_handle_t*>& /*handles*/)
{
REPORT_FUNCTION();
}

#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3
namespace android
{
Expand Down
8 changes: 8 additions & 0 deletions hybris/include/hybris/internal/camera_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <stdint.h>
#include <unistd.h>

#if ANDROID_VERSION_MAJOR >= 9
#include <vector>
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -75,6 +79,10 @@ struct CameraControl : public android::CameraListener,
#if ANDROID_VERSION_MAJOR >= 7
void postRecordingFrameHandleTimestamp(nsecs_t timestamp, native_handle_t* handle);
#endif
#if ANDROID_VERSION_MAJOR >= 9
void postRecordingFrameHandleTimestampBatch(const std::vector<nsecs_t>& timestamps,
const std::vector<native_handle_t*>& handles);
#endif
};


Expand Down

0 comments on commit 61fec85

Please sign in to comment.