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

Commit 603414d5 authored by Shuzhen Wang's avatar Shuzhen Wang Committed by Android (Google) Code Review
Browse files

Merge "Camera: Add support for hidden physical camera IDs"

parents 5e84c1ae f9d2c02e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -149,8 +149,10 @@ interface ICameraService
    const int API_VERSION_1 = 1;
    const int API_VERSION_2 = 2;

    // Determines if a particular API version is supported directly
    // Determines if a particular API version is supported directly for a cameraId.
    boolean supportsCameraApi(String cameraId, int apiVersion);
    // Determines if a cameraId is a hidden physical camera of a logical multi-camera.
    boolean isHiddenPhysicalCamera(String cameraId);

    void setTorchMode(String cameraId, boolean enabled, IBinder clientBinder);

+8 −2
Original line number Diff line number Diff line
@@ -7209,8 +7209,14 @@ typedef enum acamera_metadata_enum_acamera_request_available_capabilities {
    ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING           = 10,

    /**
     * <p>The camera device is a logical camera backed by two or more physical cameras that are
     * also exposed to the application.</p>
     * <p>The camera device is a logical camera backed by two or more physical cameras. In
     * API level 28, the physical cameras must also be exposed to the application via
     * <a href="https://developer.android.com/reference/android/hardware/camera2/CameraManager.html#getCameraIdList">CameraManager#getCameraIdList</a>. Starting from API
     * level 29, some or all physical cameras may not be independently exposed to the
     * application, in which case the physical camera IDs will not be available in
     * <a href="https://developer.android.com/reference/android/hardware/camera2/CameraManager.html#getCameraIdList">CameraManager#getCameraIdList</a>. But the application
     * can still query the physical cameras' characteristics by calling
     * <a href="https://developer.android.com/reference/android/hardware/camera2/CameraManager.html#getCameraCharacteristics">CameraManager#getCameraCharacteristics</a>.</p>
     * <p>Camera application shouldn't assume that there are at most 1 rear camera and 1 front
     * camera in the system. For an application that switches between front and back cameras,
     * the recommendation is to switch between the first rear camera and the first front
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ cc_library_shared {
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.5",
    ],

    export_shared_lib_headers: [
+15 −1
Original line number Diff line number Diff line
@@ -635,6 +635,7 @@ Status CameraService::makeClient(const sp<CameraService>& cameraService,
          case CAMERA_DEVICE_API_VERSION_3_2:
          case CAMERA_DEVICE_API_VERSION_3_3:
          case CAMERA_DEVICE_API_VERSION_3_4:
          case CAMERA_DEVICE_API_VERSION_3_5:
            if (effectiveApiLevel == API_1) { // Camera1 API route
                sp<ICameraClient> tmp = static_cast<ICameraClient*>(cameraCb.get());
                *client = new Camera2Client(cameraService, tmp, packageName,
@@ -1732,6 +1733,7 @@ Status CameraService::supportsCameraApi(const String16& cameraId, int apiVersion
        case CAMERA_DEVICE_API_VERSION_3_2:
        case CAMERA_DEVICE_API_VERSION_3_3:
        case CAMERA_DEVICE_API_VERSION_3_4:
        case CAMERA_DEVICE_API_VERSION_3_5:
            ALOGV("%s: Camera id %s uses HAL3.2 or newer, supports api1/api2 directly",
                    __FUNCTION__, id.string());
            *isSupported = true;
@@ -1752,6 +1754,18 @@ Status CameraService::supportsCameraApi(const String16& cameraId, int apiVersion
    return Status::ok();
}

Status CameraService::isHiddenPhysicalCamera(const String16& cameraId,
        /*out*/ bool *isSupported) {
    ATRACE_CALL();

    const String8 id = String8(cameraId);

    ALOGV("%s: for camera ID = %s", __FUNCTION__, id.string());
    *isSupported = mCameraProviderManager->isHiddenPhysicalCamera(id.string());

    return Status::ok();
}

void CameraService::removeByClient(const BasicClient* client) {
    Mutex::Autolock lock(mServiceLock);
    for (auto& i : mActiveClientManager.getAll()) {
+5 −0
Original line number Diff line number Diff line
@@ -159,6 +159,11 @@ public:
            /*out*/
            bool *isSupported);

    virtual binder::Status    isHiddenPhysicalCamera(
            const String16& cameraId,
            /*out*/
            bool *isSupported);

    // Extra permissions checks
    virtual status_t    onTransact(uint32_t code, const Parcel& data,
                                   Parcel* reply, uint32_t flags);
Loading