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

Commit fcb78cb6 authored by Avichal Rakesh's avatar Avichal Rakesh
Browse files

cameraservice: Add AIDL vndk client support

With HIDL being deprecated, vndk camera clients were moved to stable
AIDL interfaces. This CL adds support for AIDL vndk clients to the
cameraservice. It leaves in support for HIDL vndk clients as vendor
partition might not be updated with the system partition.

As of this CL, cameraservice supports both AIDL vndk clients and HIDL
VNDK clients. Specifically, this CL creates a new cameraservice
endpoint for AIDL vndk clients to interact with and creates a thin
shim that translates vndk AIDL data structures to ndk AIDL data
structures before passing it to main cameraservice logic.

Bug: 243593375
Test: Migrating VTS test in a future CL
Change-Id: Iaf7a434650d5f95149ccb7fcbf1a134852d6f71c
parent f099b237
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ cc_binary {
        "libui",
        "libgui",
        "libbinder",
        "libbinder_ndk",
        "libhidlbase",
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.provider@2.4",
@@ -59,6 +60,6 @@ cc_binary {
    init_rc: ["cameraserver.rc"],

    vintf_fragments: [
        "manifest_android.frameworks.cameraservice.service@2.2.xml",
        "manifest_android.frameworks.cameraservice.service.xml",
    ],
}
+1 −0
Original line number Diff line number Diff line
@@ -6,3 +6,4 @@ service cameraserver /system/bin/cameraserver
    task_profiles CameraServiceCapacity MaxPerformance
    rlimit rtprio 10 10
    onrestart class_restart cameraWatchdog
    interface aidl android.frameworks.cameraservice.service.ICameraService/default
+9 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
//#define LOG_NDEBUG 0

#include "CameraService.h"
#include <android/binder_process.h>
#include <hidl/HidlTransportSupport.h>

using namespace android;
@@ -26,15 +27,21 @@ int main(int argc __unused, char** argv __unused)
{
    signal(SIGPIPE, SIG_IGN);

    // Set 5 threads for HIDL calls. Now cameraserver will serve HIDL calls in
    // addition to consuming them from the Camera HAL as well.
    // Set 5 threads for HIDL calls. Now cameraserver will serve HIDL calls.
    hardware::configureRpcThreadpool(5, /*willjoin*/ false);

    // Set 5 threads for VNDK AIDL calls. Now cameraserver will serve
    // VNDK AIDL calls in addition to consuming them from the Camera HAL as well.
    ABinderProcess_setThreadPoolMaxThreadCount(5);

    sp<ProcessState> proc(ProcessState::self());
    sp<IServiceManager> sm = defaultServiceManager();
    ALOGI("ServiceManager: %p", sm.get());
    CameraService::instantiate();
    ALOGI("ServiceManager: %p done instantiate", sm.get());
    ProcessState::self()->startThreadPool();
    ABinderProcess_startThreadPool();

    IPCThreadState::self()->joinThreadPool();
    ABinderProcess_joinThreadPool();
}
+9 −0
Original line number Diff line number Diff line
@@ -8,4 +8,13 @@
            <instance>default</instance>
        </interface>
    </hal>

    <hal format="aidl">
        <name>android.frameworks.cameraservice.service</name>
        <version>1</version>
        <interface>
            <name>ICameraService</name>
            <instance>default</instance>
        </interface>
    </hal>
</manifest>
+9 −0
Original line number Diff line number Diff line
@@ -95,6 +95,12 @@ cc_library_shared {
        "hidl/HidlCameraDeviceUser.cpp",
        "hidl/HidlCameraService.cpp",
        "hidl/Utils.cpp",
        "aidl/AidlCameraDeviceCallbacks.cpp",
        "aidl/AidlCameraDeviceUser.cpp",
        "aidl/AidlCameraService.cpp",
        "aidl/AidlCameraServiceListener.cpp",
        "aidl/AidlUtils.cpp",
        "aidl/DeathPipe.cpp",
        "utils/CameraServiceProxyWrapper.cpp",
        "utils/CameraThreadState.cpp",
        "utils/CameraTraces.cpp",
@@ -151,6 +157,9 @@ cc_library_shared {
        "android.frameworks.cameraservice.service@2.2",
        "android.frameworks.cameraservice.device@2.0",
        "android.frameworks.cameraservice.device@2.1",
        "android.frameworks.cameraservice.common-V1-ndk",
        "android.frameworks.cameraservice.service-V1-ndk",
        "android.frameworks.cameraservice.device-V1-ndk",
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.5",
Loading