Skip to content

Commit

Permalink
[android8] Initial Android 8 support. Fixes MER#1923
Browse files Browse the repository at this point in the history
Change-Id: I05ea2cfe8947c9dcf7cb4f79df0de0e882890835
  • Loading branch information
mlehtima committed Jun 22, 2018
1 parent efad9ac commit d474106
Show file tree
Hide file tree
Showing 10 changed files with 531 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ LOCAL_SHARED_LIBRARIES := libc \
libstagefright \
libstagefright_foundation \
libmedia

ifeq ($(strip $(ANDROID_MAJOR)),8)
LOCAL_SHARED_LIBRARIES += liblog
endif

LOCAL_CPPFLAGS=-DANDROID_MAJOR=$(ANDROID_MAJOR) -DANDROID_MINOR=$(ANDROID_MINOR) -DANDROID_MICRO=$(ANDROID_MICRO) $(FORCE_HAL_PARAM)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libdroidmedia
Expand All @@ -65,6 +70,12 @@ endif
ifeq ($(strip $(ANDROID_MAJOR)),7)
LOCAL_C_INCLUDES := frameworks/native/include/media/openmax \
frameworks/native/include/media/hardware
else ifeq ($(strip $(ANDROID_MAJOR)),8)
LOCAL_C_INCLUDES := frameworks/native/include/media/openmax \
frameworks/native/include/media/hardware \
frameworks/native/libs/nativewindow/include \
frameworks/av/media/libstagefright/omx/include \
frameworks/av/media/libstagefright/xmlparser/include
else
LOCAL_C_INCLUDES := frameworks/native/include/media/openmax
endif
Expand All @@ -85,6 +96,18 @@ LOCAL_SHARED_LIBRARIES := libcameraservice \
libgui \
libcutils \
libui

ifeq ($(strip $(ANDROID_MAJOR)),8)
LOCAL_C_INCLUDES += frameworks/native/libs/sensor/include \
frameworks/av/media/libstagefright/omx/include
LOCAL_SHARED_LIBRARIES += liblog \
libhidlbase \
libhidltransport \
libsensor \
[email protected] \
[email protected]
endif

LOCAL_MODULE_TAGS := optional
LOCAL_CPPFLAGS=-DANDROID_MAJOR=$(ANDROID_MAJOR) -DANDROID_MINOR=$(ANDROID_MINOR) -DANDROID_MICRO=$(ANDROID_MICRO)
LOCAL_MODULE := minimediaservice
Expand All @@ -101,6 +124,18 @@ LOCAL_SHARED_LIBRARIES := libutils \
libgui \
libcutils \
libui

ifeq ($(strip $(ANDROID_MAJOR)),8)
LOCAL_C_INCLUDES := frameworks/native/libs/sensor/include \
frameworks/native/include
LOCAL_SHARED_LIBRARIES += liblog \
libhidlbase \
libhidltransport \
libsensor \
[email protected] \
[email protected]
endif

LOCAL_MODULE_TAGS := optional
LOCAL_CPPFLAGS := -DANDROID_MAJOR=$(ANDROID_MAJOR) -DANDROID_MINOR=$(ANDROID_MINOR) -DANDROID_MICRO=$(ANDROID_MICRO)
ifneq ($(CM_BUILD),)
Expand Down Expand Up @@ -131,6 +166,16 @@ endif
ifneq ($(shell cat frameworks/native/services/surfaceflinger/SurfaceFlinger.h |grep getDisplayInfoEx),)
LOCAL_CPPFLAGS += -DUSE_SERVICES_VENDOR_EXTENSION
endif
ifeq ($(strip $(ANDROID_MAJOR)),8)
LOCAL_SHARED_LIBRARIES += liblog \
libcamera_client \
libhidlbase \
libhidltransport \
libsensor \
[email protected] \
[email protected]
endif

LOCAL_MODULE := libminisf
ifeq ($(strip $(DROIDMEDIA_32)), true)
LOCAL_MODULE_TARGET_ARCH := arm
Expand Down
2 changes: 2 additions & 0 deletions allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Authored by: Mohammed Hassan <[email protected]>
*/

#if ANDROID_MAJOR < 8
#include "allocator.h"
#include <ui/GraphicBuffer.h>

Expand Down Expand Up @@ -67,3 +68,4 @@ void DroidMediaAllocator::setGraphicBufferSize(int size)
{
m_size = size;
}
#endif
13 changes: 13 additions & 0 deletions droidmediacamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
*/

#include "droidmediacamera.h"
#if ANDROID_MAJOR < 8
#include "allocator.h"
#endif
#include <camera/Camera.h>
#include <camera/CameraParameters.h>
#include <android/log.h>
#include <utils/String8.h>
#include <utils/Condition.h>
#if ANDROID_MAJOR >= 8
#include <media/hardware/MetadataBufferType.h>
#endif
#include <media/stagefright/CameraSource.h>
#include <media/openmax/OMX_IVCommon.h>
#include "droidmediabuffer.h"
Expand Down Expand Up @@ -220,6 +225,14 @@ class CameraListener : public android::CameraListener {
}
#endif

#if ANDROID_MAJOR >= 8
void postRecordingFrameHandleTimestampBatch(const std::vector<nsecs_t>& timestamps,
const std::vector<native_handle_t*>& handles)
{
ALOGW("postRecordingFrameHandleTimestampBatch - not sure what to do");
}
#endif

void sendPreviewMetadata(camera_frame_metadata_t *metadata)
{
android::Vector<DroidMediaCameraFace> faces;
Expand Down
6 changes: 6 additions & 0 deletions droidmediacodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
* Authored by: Mohammed Hassan <[email protected]>
*/

#if ANDROID_MAJOR >= 8
#include <media/stagefright/omx/OMX.h>
#else
#include <media/stagefright/OMXClient.h>
#endif

// MediaCodecSource should be used instead of OMXCodec from Android 5
#if ANDROID_MAJOR >= 5
Expand All @@ -43,7 +47,9 @@
#include <media/stagefright/MediaDefs.h>
#include <gui/BufferQueue.h>
#include "droidmediacodec.h"
#if ANDROID_MAJOR < 8
#include "allocator.h"
#endif
#include "private.h"
#include "droidmediabuffer.h"

Expand Down
4 changes: 4 additions & 0 deletions droidmediaconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ typedef struct {
typedef struct {
int HAL_PIXEL_FORMAT_YV12;
int HAL_PIXEL_FORMAT_RAW_SENSOR;
#if ANDROID_MAJOR < 8
int HAL_PIXEL_FORMAT_YCrCb_420_SP;
#else
int HAL_PIXEL_FORMAT_YCRCB_420_SP;
#endif
} DroidMediaPixelFormatConstants;

typedef struct {
Expand Down
2 changes: 2 additions & 0 deletions libminisf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <binder/IServiceManager.h>
#include <binder/BinderService.h>
#include <binder/MemoryHeapBase.h>
#if ANDROID_MAJOR < 8
#include "allocator.h"
#endif
#include "services/services.h"

using namespace android;
Expand Down
4 changes: 4 additions & 0 deletions minimedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
#include <binder/IInterface.h>
#include <cutils/multiuser.h>
#endif
#if ANDROID_MAJOR < 8
#include "allocator.h"
#endif
#include "services/services.h"

#define LOG_TAG "MinimediaService"
Expand Down Expand Up @@ -64,7 +66,9 @@ main(int, char**)
#if ANDROID_MAJOR >= 6
FakeResourceManagerService::instantiate();
FakeProcessInfoService::instantiate();
#if ANDROID_MAJOR < 8
FakeCameraServiceProxy::instantiate();
#endif
// Camera service needs to be told which users may use the camera
sp<IBinder> binder;
do {
Expand Down
2 changes: 2 additions & 0 deletions minisf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <binder/IServiceManager.h>
#include <binder/BinderService.h>
#include <binder/MemoryHeapBase.h>
#if ANDROID_MAJOR < 8
#include "allocator.h"
#endif
#include "services/services.h"

using namespace android;
Expand Down
4 changes: 4 additions & 0 deletions services/services.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@
#include "services_7_1_0.h"
#endif

#if ANDROID_MAJOR == 8 && ANDROID_MINOR == 1
#include "services_8_1_0.h"
#endif

#endif
Loading

0 comments on commit d474106

Please sign in to comment.