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

Commit ddaa6d87 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11800966 from 3cc94ac8 to 24Q3-release

Change-Id: I9c15f089162143fafb3fafc41c6c81f7f6dbe08c
parents 3c99dbe3 3cc94ac8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -70,11 +70,11 @@ Camera::~Camera()
}

sp<Camera> Camera::connect(int cameraId, const std::string& clientPackageName,
        int clientUid, int clientPid, int targetSdkVersion, bool overrideToPortrait,
        int clientUid, int clientPid, int targetSdkVersion, int rotationOverride,
        bool forceSlowJpegMode, int32_t deviceId, int32_t devicePolicy)
{
    return CameraBaseT::connect(cameraId, clientPackageName, clientUid,
            clientPid, targetSdkVersion, overrideToPortrait, forceSlowJpegMode, deviceId,
            clientPid, targetSdkVersion, rotationOverride, forceSlowJpegMode, deviceId,
            devicePolicy);
}

+6 −6
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ template <typename TCam, typename TCamTraits>
sp<TCam> CameraBase<TCam, TCamTraits>::connect(int cameraId,
                                               const std::string& clientPackageName,
                                               int clientUid, int clientPid, int targetSdkVersion,
                                               bool overrideToPortrait, bool forceSlowJpegMode,
                                               int rotationOverride, bool forceSlowJpegMode,
                                               int32_t deviceId, int32_t devicePolicy)
{
    ALOGV("%s: connect", __FUNCTION__);
@@ -174,10 +174,10 @@ sp<TCam> CameraBase<TCam, TCamTraits>::connect(int cameraId,
    binder::Status ret;
    if (cs != nullptr) {
        TCamConnectService fnConnectService = TCamTraits::fnConnectService;
        ALOGI("Connect camera (legacy API) - overrideToPortrait %d, forceSlowJpegMode %d",
                overrideToPortrait, forceSlowJpegMode);
        ALOGI("Connect camera (legacy API) - rotationOverride %d, forceSlowJpegMode %d",
                rotationOverride, forceSlowJpegMode);
        ret = (cs.get()->*fnConnectService)(cl, cameraId, clientPackageName, clientUid,
                clientPid, targetSdkVersion, overrideToPortrait, forceSlowJpegMode, deviceId,
                clientPid, targetSdkVersion, rotationOverride, forceSlowJpegMode, deviceId,
                devicePolicy, /*out*/ &c->mCamera);
    }
    if (ret.isOk() && c->mCamera != nullptr) {
@@ -279,11 +279,11 @@ int CameraBase<TCam, TCamTraits>::getNumberOfCameras(int32_t deviceId, int32_t d
// this can be in BaseCamera but it should be an instance method
template <typename TCam, typename TCamTraits>
status_t CameraBase<TCam, TCamTraits>::getCameraInfo(int cameraId,
        bool overrideToPortrait, int32_t deviceId, int32_t devicePolicy,
        int rotationOverride, int32_t deviceId, int32_t devicePolicy,
        struct hardware::CameraInfo* cameraInfo) {
    const sp<::android::hardware::ICameraService> cs = getCameraService();
    if (cs == 0) return UNKNOWN_ERROR;
    binder::Status res = cs->getCameraInfo(cameraId, overrideToPortrait, deviceId, devicePolicy,
    binder::Status res = cs->getCameraInfo(cameraId, rotationOverride, deviceId, devicePolicy,
            cameraInfo);
    return res.isOk() ? OK : res.serviceSpecificErrorCode();
}
+63 −26
Original line number Diff line number Diff line
@@ -75,12 +75,29 @@ interface ICameraService
     */
    int getNumberOfCameras(int type, int deviceId, int devicePolicy);

    /**
     * If changed, reflect in
     * frameworks/base/core/java/android/hardware/camera2/CameraManager.java.
     * We have an enum here since the decision to override to portrait mode / fetch the
     * rotationOverride as it exists in CameraManager right now is based on a static system
     * property and not something that changes based dynamically, say on fold state. As a result,
     * we can't use just a boolean to differentiate between the case where cameraserver should
     * override to portrait (sensor orientation is 0, 180) or just rotate the sensor feed (sensor
     * orientation is 90, 270)
     */
    const int ROTATION_OVERRIDE_NONE = 0;
    const int ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT = 1;
    const int ROTATION_OVERRIDE_ROTATION_ONLY = 2;

    /**
     * Fetch basic camera information for a camera.
     *
     * @param cameraId The ID of the camera to fetch information for.
     * @param overrideToPortrait Whether to override the sensor orientation information to
     *        correspond to portrait.
     * @param rotationOverride Whether to override the sensor orientation information to
     *        correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT}
     *        will override the sensor orientation and rotate and crop, while {@link
     *        ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed
     *        without changing the sensor orientation.
     * @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
     *                     policy for default device context). Only virtual cameras would be exposed
@@ -88,7 +105,7 @@ interface ICameraService
     *                     policy.
     * @return CameraInfo for the camera.
     */
    CameraInfo getCameraInfo(int cameraId, boolean overrideToPortrait, int deviceId,
    CameraInfo getCameraInfo(int cameraId, int rotationOverride, int deviceId,
            int devicePolicy);

    /**
@@ -105,8 +122,12 @@ interface ICameraService
     * @param opPackageName The package name to report for the app-ops.
     * @param clientUid UID for the calling client.
     * @param clientPid PID for the calling client.
     * @param overrideToPortrait Whether to override the sensor orientation information to
     *        correspond to portrait.
     * @param targetSdkVersion the target sdk level of the application calling this function.
     * @param rotationOverride Whether to override the sensor orientation information to
     *        correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT}
     *        will override the sensor orientation and rotate and crop, while {@link
     *        ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed
     *        without changing the sensor orientation.
     * @param forceSlowJpegMode Whether to force slow jpeg mode.
     * @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
@@ -119,7 +140,7 @@ interface ICameraService
            @utf8InCpp String opPackageName,
            int clientUid, int clientPid,
            int targetSdkVersion,
            boolean overrideToPortrait,
            int rotationOverride,
            boolean forceSlowJpegMode,
            int deviceId,
            int devicePolicy);
@@ -131,8 +152,12 @@ interface ICameraService
     * @param cameraId The ID of the camera to open.
     * @param opPackageName The package name to report for the app-ops.
     * @param clientUid UID for the calling client.
     * @param overrideToPortrait Whether to override the sensor orientation information to
     *        correspond to portrait.
     * @param targetSdkVersion the target sdk level of the application calling this function.
     * @param rotationOverride Whether to override the sensor orientation information to
     *        correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT}
     *        will override the sensor orientation and rotate and crop, while {@link
     *        ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed
     *        without changing the sensor orientation.
     * @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
     *                     policy for default device context). Only virtual cameras would be exposed
@@ -145,7 +170,7 @@ interface ICameraService
            @nullable @utf8InCpp String featureId,
            int clientUid, int oomScoreOffset,
            int targetSdkVersion,
            boolean overrideToPortrait,
            int rotationOverride,
            int deviceId,
            int devicePolicy);

@@ -170,6 +195,11 @@ interface ICameraService
     *
     * @param sessions the set of camera id and session configuration pairs to be queried.
     * @param targetSdkVersion the target sdk level of the application calling this function.
     * @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
     *                     policy for default device context). Only virtual cameras would be exposed
     *                     only for custom policy and only real cameras would be exposed for default
     *                     policy.
     * @return true  - the set of concurrent camera id and stream combinations is supported.
     *         false - the set of concurrent camera id and stream combinations is not supported
     *                 OR the method was called with a set of camera ids not returned by
@@ -177,7 +207,7 @@ interface ICameraService
     */
    boolean isConcurrentSessionConfigurationSupported(
            in CameraIdAndSessionConfiguration[] sessions,
            int targetSdkVersion);
            int targetSdkVersion, int deviceId, int devicePolicy);

    /**
     * Remap Camera Ids in the CameraService.
@@ -217,8 +247,12 @@ interface ICameraService
     * Only supported for device HAL versions >= 3.2
     *
     * @param cameraId The ID of the camera to fetch metadata for.
     * @param overrideToPortrait Whether to override the sensor orientation information to
     *        correspond to portrait.
     * @param targetSdkVersion the target sdk level of the application calling this function.
     * @param rotationOverride Whether to override the sensor orientation information to
     *        correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT}
     *        will override the sensor orientation and rotate and crop, while {@link
     *        ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed
     *        without changing the sensor orientation.
     * @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
     *                     policy for default device context). Only virtual cameras would be exposed
@@ -227,7 +261,7 @@ interface ICameraService
     * @return Characteristics for the given camera.
     */
    CameraMetadataNative getCameraCharacteristics(@utf8InCpp String cameraId, int targetSdkVersion,
            boolean overrideToPortrait, int deviceId, int devicePolicy);
            int rotationOverride, int deviceId, int devicePolicy);

    /**
     * Read in the vendor tag descriptors from the camera module HAL.
@@ -403,8 +437,11 @@ interface ICameraService
     *
     * @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 rotationOverride Whether to override the sensor orientation information to
     *        correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT}
     *        will override the sensor orientation and rotate and crop, while {@link
     *        ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed
     *        without changing the sensor orientation.
     * @param sessionConfiguration Session configuration for which the characteristics
     *                             must be fetched.
     * @param deviceId The device id of the context associated with the caller.
@@ -416,7 +453,7 @@ interface ICameraService
     */
    CameraMetadataNative getSessionCharacteristics(@utf8InCpp String cameraId,
            int targetSdkVersion,
            boolean overrideToPortrait,
            int rotationOverride,
            in SessionConfiguration sessionConfiguration,
            int deviceId,
            int devicePolicy);
+22 −14
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ namespace utils {
ConcurrentCameraIdCombination::ConcurrentCameraIdCombination() = default;

ConcurrentCameraIdCombination::ConcurrentCameraIdCombination(
        std::vector<std::string> &&combination) : mConcurrentCameraIds(std::move(combination)) { }
        std::vector<std::pair<std::string, int32_t>> &&combination)
            : mConcurrentCameraIdDeviceIdPairs(std::move(combination)) { }

ConcurrentCameraIdCombination::~ConcurrentCameraIdCombination() = default;

@@ -42,25 +43,29 @@ status_t ConcurrentCameraIdCombination::readFromParcel(const android::Parcel* pa
        return BAD_VALUE;
    }
    status_t err = OK;
    mConcurrentCameraIds.clear();
    int32_t cameraIdCount = 0;
    if ((err = parcel->readInt32(&cameraIdCount)) != OK) {
        ALOGE("%s: Failed to read the camera id count from parcel: %d", __FUNCTION__, err);
    mConcurrentCameraIdDeviceIdPairs.clear();
    int32_t cameraCount = 0;
    if ((err = parcel->readInt32(&cameraCount)) != OK) {
        ALOGE("%s: Failed to read the camera count from parcel: %d", __FUNCTION__, err);
        return err;
    }
    for (int32_t i = 0; i < cameraIdCount; i++) {
        String16 id;
        if ((err = parcel->readString16(&id)) != OK) {
    for (int32_t i = 0; i < cameraCount; i++) {
        String16 cameraId;
        if ((err = parcel->readString16(&cameraId)) != OK) {
            ALOGE("%s: Failed to read camera id!", __FUNCTION__);
            return err;
        }
        mConcurrentCameraIds.push_back(toStdString(id));
        int32_t deviceId;
        if ((err = parcel->readInt32(&deviceId)) != OK) {
            ALOGE("%s: Failed to read device id!", __FUNCTION__);
            return err;
        }
        mConcurrentCameraIdDeviceIdPairs.push_back({toStdString(cameraId), deviceId});
    }
    return OK;
}

status_t ConcurrentCameraIdCombination::writeToParcel(android::Parcel* parcel) const {

    if (parcel == nullptr) {
        ALOGE("%s: Null parcel", __FUNCTION__);
        return BAD_VALUE;
@@ -68,16 +73,20 @@ status_t ConcurrentCameraIdCombination::writeToParcel(android::Parcel* parcel) c

    status_t err = OK;

    if ((err = parcel->writeInt32(mConcurrentCameraIds.size())) != OK) {
    if ((err = parcel->writeInt32(mConcurrentCameraIdDeviceIdPairs.size())) != OK) {
        ALOGE("%s: Failed to write the camera id count to parcel: %d", __FUNCTION__, err);
        return err;
    }

    for (const auto &it : mConcurrentCameraIds) {
        if ((err = parcel->writeString16(toString16(it))) != OK) {
    for (const auto &it : mConcurrentCameraIdDeviceIdPairs) {
        if ((err = parcel->writeString16(toString16(it.first))) != OK) {
            ALOGE("%s: Failed to write the camera id string to parcel: %d", __FUNCTION__, err);
            return err;
        }
        if ((err = parcel->writeInt32(it.second)) != OK) {
            ALOGE("%s: Failed to write the device id integer to parcel: %d", __FUNCTION__, err);
            return err;
        }
    }
    return OK;
}
@@ -105,7 +114,6 @@ status_t CameraIdAndSessionConfiguration::readFromParcel(const android::Parcel*
}

status_t CameraIdAndSessionConfiguration::writeToParcel(android::Parcel* parcel) const {

    if (parcel == nullptr) {
        ALOGE("%s: Null parcel", __FUNCTION__);
        return BAD_VALUE;
+10 −0
Original line number Diff line number Diff line
@@ -217,3 +217,13 @@ flag {
     description: "Miscellaneous camera platform metrics for 24Q3"
     bug: "332557570"
}

flag {
     namespace: "camera_platform"
     name: "realtime_priority_bump"
     description: "Bump the scheduling priority of performance critical code paths"
     bug: "336628522"
     metadata {
       purpose: PURPOSE_BUGFIX
     }
}
Loading