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

Commit fbb176e0 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by Android (Google) Code Review
Browse files

Merge changes from topic "camera-provider-2.5"

* changes:
  Camera: Add default 2.5 provider for legacy and external webcam HALs
  Camera: Restructure default camera.provider 2.4
  camera.provider: Add @2.5 to support notifyDeviceStatusChange
parents 3e9aeb2e aa04b3ba
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -462,6 +462,17 @@ int CameraModule::isStreamCombinationSupported(int cameraId, camera_stream_combi
    return res;
    return res;
}
}


void CameraModule::notifyDeviceStateChange(uint64_t deviceState) {
   if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_5 &&
           mModule->notify_device_state_change != NULL) {
       ATRACE_BEGIN("camera_module->notify_device_state_change");
       ALOGI("%s: calling notify_device_state_change with state %" PRId64, __FUNCTION__,
               deviceState);
       mModule->notify_device_state_change(deviceState);
       ATRACE_END();
   }
}

status_t CameraModule::filterOpenErrorCode(status_t err) {
status_t CameraModule::filterOpenErrorCode(status_t err) {
    switch(err) {
    switch(err) {
        case NO_ERROR:
        case NO_ERROR:
+1 −0
Original line number Original line Diff line number Diff line
@@ -67,6 +67,7 @@ public:
    void removeCamera(int cameraId);
    void removeCamera(int cameraId);
    int getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo);
    int getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo);
    int isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams);
    int isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams);
    void notifyDeviceStateChange(uint64_t deviceState);


private:
private:
    // Derive camera characteristics keys defined after HAL device version
    // Derive camera characteristics keys defined after HAL device version
+3 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,9 @@ hidl_interface {
    ],
    ],
    types: [
    types: [
        "CameraMetadataEnumAndroidInfoSupportedBufferManagementVersion",
        "CameraMetadataEnumAndroidInfoSupportedBufferManagementVersion",
        "CameraMetadataEnumAndroidScalerAvailableFormats",
        "CameraMetadataEnumAndroidScalerAvailableRecommendedStreamConfigurations",
        "CameraMetadataEnumAndroidSensorInfoColorFilterArrangement",
        "CameraMetadataTag",
        "CameraMetadataTag",
    ],
    ],
    gen_java: true,
    gen_java: true,
+127 −26
Original line number Original line Diff line number Diff line
cc_library_shared {
cc_library_shared {
    name: "android.hardware.camera.provider@2.4-impl",
    name: "android.hardware.camera.provider@2.4-legacy",
    defaults: ["hidl_defaults"],
    defaults: ["hidl_defaults"],
    proprietary: true,
    proprietary: true,
    relative_install_path: "hw",
    srcs: ["LegacyCameraProviderImpl_2_4.cpp"],
    srcs: ["CameraProvider.cpp",
           "ExternalCameraProvider.cpp"],
    shared_libs: [
    shared_libs: [
        "libhidlbase",
        "android.hardware.camera.common@1.0",
        "libhidltransport",
        "libutils",
        "libcutils",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.provider@2.4",
        "android.hardware.graphics.mapper@2.0",
        "android.hidl.allocator@1.0",
        "android.hidl.memory@1.0",
        "camera.device@1.0-impl",
        "camera.device@1.0-impl",
        "camera.device@3.2-impl",
        "camera.device@3.2-impl",
        "camera.device@3.3-impl",
        "camera.device@3.3-impl",
        "camera.device@3.4-impl",
        "camera.device@3.4-impl",
        "camera.device@3.5-impl",
        "camera.device@3.5-impl",
        "libcamera_metadata",
        "libcutils",
        "libhardware",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libutils",
    ],
    static_libs: [
        "android.hardware.camera.common@1.0-helper",
    ],
    header_libs: [
        "camera.device@3.4-impl_headers",
        "camera.device@3.5-impl_headers",
    ],
    export_include_dirs: ["."],
}

cc_library_shared {
    name: "android.hardware.camera.provider@2.4-external",
    proprietary: true,
    srcs: ["ExternalCameraProviderImpl_2_4.cpp"],
    shared_libs: [
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.provider@2.4",
        "android.hardware.graphics.mapper@2.0",
        "android.hidl.allocator@1.0",
        "android.hidl.memory@1.0",
        "camera.device@3.3-impl",
        "camera.device@3.4-external-impl",
        "camera.device@3.4-external-impl",
        "camera.device@3.4-impl",
        "camera.device@3.5-external-impl",
        "camera.device@3.5-external-impl",
        "android.hardware.camera.provider@2.4",
        "camera.device@3.5-impl",
        "libcamera_metadata",
        "libcutils",
        "libhardware",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libtinyxml2",
        "libutils",
    ],
    static_libs: [
        "android.hardware.camera.common@1.0-helper",
    ],
    header_libs: [
        "camera.device@3.4-external-impl_headers",
        "camera.device@3.5-external-impl_headers"
    ],
    export_include_dirs: ["."],
}

cc_library_shared {
    name: "android.hardware.camera.provider@2.4-impl",
    defaults: ["hidl_defaults"],
    proprietary: true,
    relative_install_path: "hw",
    srcs: ["CameraProvider_2_4.cpp"],
    shared_libs: [
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.4-external",
        "android.hardware.camera.provider@2.4-legacy",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.0",
        "android.hidl.allocator@1.0",
        "android.hidl.allocator@1.0",
        "android.hidl.memory@1.0",
        "android.hidl.memory@1.0",
        "liblog",
        "camera.device@1.0-impl",
        "libhardware",
        "camera.device@3.2-impl",
        "camera.device@3.3-impl",
        "camera.device@3.4-external-impl",
        "camera.device@3.4-impl",
        "camera.device@3.5-external-impl",
        "camera.device@3.5-impl",
        "libcamera_metadata",
        "libcamera_metadata",
        "libtinyxml2"
        "libcutils",
        "libhardware",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libtinyxml2",
        "libutils",
    ],
    ],
    header_libs: [
    header_libs: [
        "camera.device@3.4-external-impl_headers",
        "camera.device@3.4-impl_headers",
        "camera.device@3.4-impl_headers",
        "camera.device@3.5-external-impl_headers",
        "camera.device@3.5-impl_headers",
        "camera.device@3.5-impl_headers",
        "camera.device@3.4-external-impl_headers",
        "camera.device@3.5-external-impl_headers"
    ],
    ],
    static_libs: [
    static_libs: [
        "android.hardware.camera.common@1.0-helper",
        "android.hardware.camera.common@1.0-helper",
    ],
    ],
    export_include_dirs: ["."],
}
}


cc_defaults {
cc_defaults {
@@ -50,18 +130,32 @@ cc_defaults {
    relative_install_path: "hw",
    relative_install_path: "hw",
    srcs: ["service.cpp"],
    srcs: ["service.cpp"],
    shared_libs: [
    shared_libs: [
        "libhidlbase",
        "android.hardware.camera.common@1.0",
        "libhidltransport",
        "libbinder",
        "liblog",
        "libutils",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.common@1.0",
        "android.hardware.graphics.mapper@2.0",
        "android.hidl.allocator@1.0",
        "android.hidl.memory@1.0",
        "libbinder",
        "libcamera_metadata",
        "libhardware",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libutils",
    ],
    static_libs: [
        "android.hardware.camera.common@1.0-helper",
    ],
    header_libs: [
        "camera.device@3.4-external-impl_headers",
        "camera.device@3.4-impl_headers",
        "camera.device@3.5-external-impl_headers",
        "camera.device@3.5-impl_headers",
    ],
    ],
}
}


@@ -106,17 +200,24 @@ cc_binary {
    compile_multilib: "32",
    compile_multilib: "32",
    init_rc: ["android.hardware.camera.provider@2.4-external-service.rc"],
    init_rc: ["android.hardware.camera.provider@2.4-external-service.rc"],
    shared_libs: [
    shared_libs: [
        "libhidlbase",
        "android.hardware.camera.common@1.0",
        "libhidltransport",
        "libbinder",
        "liblog",
        "libutils",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.common@1.0",
        "libbinder",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libtinyxml2",
        "libutils",
    ],
    header_libs: [
        "camera.device@3.4-external-impl_headers",
        "camera.device@3.4-impl_headers",
        "camera.device@3.5-external-impl_headers",
        "camera.device@3.5-impl_headers",
    ],
    ],
}
}
+69 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "CameraProvider_2_4.h"
#include "LegacyCameraProviderImpl_2_4.h"
#include "ExternalCameraProviderImpl_2_4.h"

const char *kLegacyProviderName = "legacy/0";
const char *kExternalProviderName = "external/0";

namespace android {
namespace hardware {
namespace camera {
namespace provider {
namespace V2_4 {
namespace implementation {

using android::hardware::camera::provider::V2_4::ICameraProvider;

extern "C" ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name);

template<typename IMPL>
CameraProvider<IMPL>* getProviderImpl() {
    CameraProvider<IMPL> *provider = new CameraProvider<IMPL>();
    if (provider == nullptr) {
        ALOGE("%s: cannot allocate camera provider!", __FUNCTION__);
        return nullptr;
    }
    if (provider->isInitFailed()) {
        ALOGE("%s: camera provider init failed!", __FUNCTION__);
        delete provider;
        return nullptr;
    }
    return provider;
}

ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name) {
    using namespace android::hardware::camera::provider::V2_4::implementation;
    ICameraProvider* provider = nullptr;
    if (strcmp(name, kLegacyProviderName) == 0) {
        provider = getProviderImpl<LegacyCameraProviderImpl_2_4>();
    } else if (strcmp(name, kExternalProviderName) == 0) {
        provider = getProviderImpl<ExternalCameraProviderImpl_2_4>();
    } else {
        ALOGE("%s: unknown instance name: %s", __FUNCTION__, name);
    }

    return provider;
}

}  // namespace implementation
}  // namespace V2_4
}  // namespace provider
}  // namespace camera
}  // namespace hardware
}  // namespace android
Loading