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

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

cameraservice: check performance class override in

isSessionConfigurationWithParametersSupported

The current implementation of
isSessionConfigurationWithParametersSupported simply hardcoded a
value of false for overrideForPerfClass parameter. This value
would typically for primary read and front cameras.

This CL passes the app's target SDK version to cameraservice
and uses it to calculate overrideForPerfClass based to follow suit
with all the other CameraService functions.

Bug: 332975108
Test: atest android.hardware.camera2.cts.CameraDeviceSetupTest passes
Change-Id: Ia93e1614f5fa9165383e84d8fdadd1c4dfbb42da
parent 8fbda41c
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -383,6 +383,7 @@ interface ICameraService
     * has camera device support.
     *
     * @param cameraId The camera id to query session configuration for
     * @param targetSdkVersion the target sdk level of the application calling this function.
     * @param sessionConfiguration Specific session configuration to be verified.
     * @param deviceId The device id of the context associated with the caller.
     * @param devicePolicy The camera policy of the device of the associated context (default
@@ -393,13 +394,17 @@ interface ICameraService
     *         false - in case there is no device support.
     */
    boolean isSessionConfigurationWithParametersSupported(@utf8InCpp String cameraId,
            in SessionConfiguration sessionConfiguration, int deviceId, int devicePolicy);
            int targetSdkVersion, in SessionConfiguration sessionConfiguration,
            int deviceId, int devicePolicy);

    /**
     * Get the camera characteristics for a particular session configuration for
     * the given camera device.
     *
     * @param cameraId ID of the device for which the session characteristics must be fetched.
     * @param targetSdkVersion the target sdk level of the application calling this function.
     * @param overrideToPortrait Whether to override the sensor orientation information to
     *                           correspond to portrait.
     * @param sessionConfiguration Session configuration for which the characteristics
     *                             must be fetched.
     * @param deviceId The device id of the context associated with the caller.
+10 −0
Original line number Diff line number Diff line
@@ -200,3 +200,13 @@ flag {
       purpose: PURPOSE_BUGFIX
     }
}

flag {
     namespace: "camera_platform"
     name: "calculate_perf_override_during_session_support"
     description: "Dynamically calulate whether perf class override should be set in isSessionConfigurationWithParametersSupported."
     bug: "332975108"
     metadata {
       purpose: PURPOSE_BUGFIX
     }
}
+7 −5
Original line number Diff line number Diff line
@@ -915,11 +915,10 @@ Status CameraService::createDefaultRequest(const std::string& unresolvedCameraId
}

Status CameraService::isSessionConfigurationWithParametersSupported(
        const std::string& unresolvedCameraId,
        const std::string& unresolvedCameraId, int targetSdkVersion,
        const SessionConfiguration& sessionConfiguration,
        int32_t deviceId, int32_t devicePolicy,
        /*out*/
        bool* supported) {
        /*out*/ bool* supported) {
    ATRACE_CALL();

    if (!flags::feature_combination_query()) {
@@ -955,9 +954,12 @@ Status CameraService::isSessionConfigurationWithParametersSupported(
                cameraId.c_str());
    }

    bool overrideForPerfClass = flags::calculate_perf_override_during_session_support() &&
                                SessionConfigurationUtils::targetPerfClassPrimaryCamera(
                                        mPerfClassPrimaryCameraIds, cameraId, targetSdkVersion);

    return isSessionConfigurationWithParametersSupportedUnsafe(cameraId, sessionConfiguration,
                                                               /*overrideForPerfClass=*/false,
                                                               supported);
                                                               overrideForPerfClass, supported);
}

Status CameraService::isSessionConfigurationWithParametersSupportedUnsafe(
+2 −3
Original line number Diff line number Diff line
@@ -256,11 +256,10 @@ public:
            hardware::camera2::impl::CameraMetadataNative* request);

    virtual binder::Status isSessionConfigurationWithParametersSupported(
            const std::string& cameraId,
            const std::string& cameraId, int targetSdkVersion,
            const SessionConfiguration& sessionConfiguration,
            int32_t deviceId, int32_t devicePolicy,
            /*out*/
            bool* supported);
            /*out*/ bool* supported);

    virtual binder::Status getSessionCharacteristics(
            const std::string& cameraId, int targetSdkVersion, bool overrideToPortrait,