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

Commit 8effe98d authored by Avichal Rakesh's avatar Avichal Rakesh
Browse files

camera: vndk: migrate from NativeHandle to ANativeWindow

The client side implementation of Camera vNDK used
NativeHandle to parcel NDK ANativeWindow, because ANativeWindow
wasn't parcelable over stable interfaces until recently. However,
this introduced an implicit dependency on HIDL as encoding
ANativeWindow to NativeHandle required HIDL Token Manager.
HIDL Token Manager is deprecated and scheduled to be removed soon.

This CL updates the client side vNDK implementation to use
ANativeWindow instead of NativeHandle. This includes updating
the shared code, which had special handling for when built for
the vNDK.

Bug: 283283111
Test: atest ACameraNdkVendorTest passes
      atest CameraCtsTestCases:Native* tests pass
      FaceHAL works OK!
Change-Id: I64a6918f041032c216dfa074d74ad2ea5b6abfeb
parent ee8631cb
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -154,8 +154,8 @@ cc_library_shared {
        "libcamera_metadata",
        "libmediandk",
        "android.frameworks.cameraservice.common-V1-ndk",
        "android.frameworks.cameraservice.device-V1-ndk",
        "android.frameworks.cameraservice.service-V1-ndk",
        "android.frameworks.cameraservice.device-V2-ndk",
        "android.frameworks.cameraservice.service-V2-ndk",
    ],
    static_libs: [
        "android.hardware.camera.common@1.0-helper",
@@ -188,7 +188,6 @@ cc_test {
    ],
    static_libs: [
        "android.hardware.camera.common@1.0-helper",
        "android.hidl.token@1.0",
    ],
    cflags: [
        "-D__ANDROID_VNDK__",
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ camera_status_t ACameraCaptureSession_setWindowPreparedCallback(
EXPORT
camera_status_t ACameraCaptureSession_prepareWindow(
        ACameraCaptureSession* session,
        ACameraWindowType *window) {
        ANativeWindow *window) {
    ATRACE_CALL();
    if (session == nullptr || window == nullptr) {
        ALOGE("%s: Error: session %p / window %p is null", __FUNCTION__, session, window);
+5 −5
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* contain

EXPORT
camera_status_t ACaptureSessionOutput_create(
        ACameraWindowType* window, /*out*/ACaptureSessionOutput** out) {
        ANativeWindow* window, /*out*/ACaptureSessionOutput** out) {
    ATRACE_CALL();
    if (window == nullptr || out == nullptr) {
        ALOGE("%s: Error: bad argument. window %p, out %p",
@@ -137,7 +137,7 @@ camera_status_t ACaptureSessionOutput_create(

EXPORT
camera_status_t ACaptureSessionSharedOutput_create(
        ACameraWindowType* window, /*out*/ACaptureSessionOutput** out) {
        ANativeWindow* window, /*out*/ACaptureSessionOutput** out) {
    ATRACE_CALL();
    if (window == nullptr || out == nullptr) {
        ALOGE("%s: Error: bad argument. window %p, out %p",
@@ -150,7 +150,7 @@ camera_status_t ACaptureSessionSharedOutput_create(

EXPORT
camera_status_t ACaptureSessionPhysicalOutput_create(
        ACameraWindowType* window, const char* physicalId,
        ANativeWindow* window, const char* physicalId,
        /*out*/ACaptureSessionOutput** out) {
    ATRACE_CALL();
    if (window == nullptr || physicalId == nullptr || out == nullptr) {
@@ -164,7 +164,7 @@ camera_status_t ACaptureSessionPhysicalOutput_create(

EXPORT
camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *out,
        ACameraWindowType* window) {
        ANativeWindow* window) {
    ATRACE_CALL();
    if ((window == nullptr) || (out == nullptr)) {
        ALOGE("%s: Error: bad argument. window %p, out %p",
@@ -190,7 +190,7 @@ camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *out,

EXPORT
camera_status_t ACaptureSessionSharedOutput_remove(ACaptureSessionOutput *out,
        ACameraWindowType* window) {
        ANativeWindow* window) {
    ATRACE_CALL();
    if ((window == nullptr) || (out == nullptr)) {
        ALOGE("%s: Error: bad argument. window %p, out %p",
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@

EXPORT
camera_status_t ACameraOutputTarget_create(
        ACameraWindowType* window, ACameraOutputTarget** out) {
        ANativeWindow* window, ACameraOutputTarget** out) {
    ATRACE_CALL();
    if (window == nullptr) {
        ALOGE("%s: Error: input window is null", __FUNCTION__);
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ camera_status_t ACameraCaptureSession::updateOutputConfiguration(ACaptureSession
    return ret;
}

camera_status_t ACameraCaptureSession::prepare(ACameraWindowType* window) {
camera_status_t ACameraCaptureSession::prepare(ANativeWindow* window) {
#ifdef __ANDROID_VNDK__
    std::shared_ptr<acam::CameraDevice> dev = getDevicePtr();
#else
Loading