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

Commit 95621165 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6118234 from b54d7da5 to rvc-release

Change-Id: Ibd7e1bc02c5901a2b1e1fa191c2562b4231f60e9
parents c80536be b54d7da5
Loading
Loading
Loading
Loading
+73 −32
Original line number Diff line number Diff line
@@ -1857,8 +1857,10 @@ typedef enum acamera_metadata_tag {
     * stream combinations of LIMITED hardware level are guaranteed.</p>
     * <p>For a logical multi-camera, bokeh may be implemented by stereo vision from sub-cameras
     * with different field of view. As a result, when bokeh mode is enabled, the camera device
     * may override android.scaler.CropRegion, and the field of view will be smaller than when
     * may override ACAMERA_SCALER_CROP_REGION, and the field of view will be smaller than when
     * bokeh mode is off.</p>
     *
     * @see ACAMERA_SCALER_CROP_REGION
     */
    ACAMERA_CONTROL_BOKEH_MODE =                                // byte (acamera_metadata_enum_android_control_bokeh_mode_t)
            ACAMERA_CONTROL_START + 45,
@@ -1873,8 +1875,10 @@ typedef enum acamera_metadata_tag {
     * </ul></p>
     *
     * <p>If the camera device supports zoom-out from 1x zoom, minZoom will be less than 1.0, and
     * setting android.control.zoomRation to values less than 1.0 increases the camera's field
     * setting ACAMERA_CONTROL_ZOOM_RATIO to values less than 1.0 increases the camera's field
     * of view.</p>
     *
     * @see ACAMERA_CONTROL_ZOOM_RATIO
     */
    ACAMERA_CONTROL_ZOOM_RATIO_RANGE =                          // float[2]
            ACAMERA_CONTROL_START + 46,
@@ -3284,32 +3288,70 @@ typedef enum acamera_metadata_tag {
     * <p>For devices not supporting ACAMERA_DISTORTION_CORRECTION_MODE control, the coordinate
     * system always follows that of ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, with <code>(0, 0)</code> being
     * the top-left pixel of the active array.</p>
     * <p>For devices supporting ACAMERA_DISTORTION_CORRECTION_MODE control, the coordinate
     * system depends on the mode being set.
     * When the distortion correction mode is OFF, the coordinate system follows
     * ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, with
     * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array.
     * When the distortion correction mode is not OFF, the coordinate system follows
     * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, with
     * <code>(0, 0)</code> being the top-left pixel of the active array.</p>
     * <p>Output streams use this rectangle to produce their output,
     * cropping to a smaller region if necessary to maintain the
     * stream's aspect ratio, then scaling the sensor input to
     * <p>For devices supporting ACAMERA_DISTORTION_CORRECTION_MODE control, the coordinate system
     * depends on the mode being set.  When the distortion correction mode is OFF, the
     * coordinate system follows ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, with <code>(0,
     * 0)</code> being the top-left pixel of the pre-correction active array.  When the distortion
     * correction mode is not OFF, the coordinate system follows
     * ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, with <code>(0, 0)</code> being the top-left pixel of the
     * active array.</p>
     * <p>Output streams use this rectangle to produce their output, cropping to a smaller region
     * if necessary to maintain the stream's aspect ratio, then scaling the sensor input to
     * match the output's configured resolution.</p>
     * <p>The crop region is applied after the RAW to other color
     * space (e.g. YUV) conversion. Since raw streams
     * (e.g. RAW16) don't have the conversion stage, they are not
     * <p>The crop region is applied after the RAW to other color space (e.g. YUV)
     * conversion. Since raw streams (e.g. RAW16) don't have the conversion stage, they are not
     * croppable. The crop region will be ignored by raw streams.</p>
     * <p>For non-raw streams, any additional per-stream cropping will
     * be done to maximize the final pixel area of the stream.</p>
     * <p>For example, if the crop region is set to a 4:3 aspect
     * ratio, then 4:3 streams will use the exact crop
     * region. 16:9 streams will further crop vertically
     * (letterbox).</p>
     * <p>Conversely, if the crop region is set to a 16:9, then 4:3
     * outputs will crop horizontally (pillarbox), and 16:9
     * streams will match exactly. These additional crops will
     * be centered within the crop region.</p>
     * <p>For non-raw streams, any additional per-stream cropping will be done to maximize the
     * final pixel area of the stream.</p>
     * <p>For example, if the crop region is set to a 4:3 aspect ratio, then 4:3 streams will use
     * the exact crop region. 16:9 streams will further crop vertically (letterbox).</p>
     * <p>Conversely, if the crop region is set to a 16:9, then 4:3 outputs will crop horizontally
     * (pillarbox), and 16:9 streams will match exactly. These additional crops will be
     * centered within the crop region.</p>
     * <p>To illustrate, here are several scenarios of different crop regions and output streams,
     * for a hypothetical camera device with an active array of size <code>(2000,1500)</code>.  Note that
     * several of these examples use non-centered crop regions for ease of illustration; such
     * regions are only supported on devices with FREEFORM capability
     * (ACAMERA_SCALER_CROPPING_TYPE <code>== FREEFORM</code>), but this does not affect the way the crop
     * rules work otherwise.</p>
     * <ul>
     * <li>Camera Configuration:<ul>
     * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li>
     * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li>
     * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li>
     * </ul>
     * </li>
     * <li>Case #1: 4:3 crop region with 2x digital zoom<ul>
     * <li>Crop region: <code>Rect(500, 375, 1500, 1125) // (left, top, right, bottom)</code></li>
     * <li><img alt="4:3 aspect ratio crop diagram" src="../images/camera2/metadata/android.scaler.cropRegion/crop-region-43-ratio.png" /></li>
     * <li><code>640x480</code> stream source area: <code>(500, 375, 1500, 1125)</code> (equal to crop region)</li>
     * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li>
     * </ul>
     * </li>
     * <li>Case #2: 16:9 crop region with ~1.5x digital zoom.<ul>
     * <li>Crop region: <code>Rect(500, 375, 1833, 1125)</code></li>
     * <li><img alt="16:9 aspect ratio crop diagram" src="../images/camera2/metadata/android.scaler.cropRegion/crop-region-169-ratio.png" /></li>
     * <li><code>640x480</code> stream source area: <code>(666, 375, 1666, 1125)</code> (pillarboxed)</li>
     * <li><code>1280x720</code> stream source area: <code>(500, 375, 1833, 1125)</code> (equal to crop region)</li>
     * </ul>
     * </li>
     * <li>Case #3: 1:1 crop region with ~2.6x digital zoom.<ul>
     * <li>Crop region: <code>Rect(500, 375, 1250, 1125)</code></li>
     * <li><img alt="1:1 aspect ratio crop diagram" src="../images/camera2/metadata/android.scaler.cropRegion/crop-region-11-ratio.png" /></li>
     * <li><code>640x480</code> stream source area: <code>(500, 469, 1250, 1031)</code> (letterboxed)</li>
     * <li><code>1280x720</code> stream source area: <code>(500, 543, 1250, 957)</code> (letterboxed)</li>
     * </ul>
     * </li>
     * <li>Case #4: Replace <code>640x480</code> stream with <code>1024x1024</code> stream, with 4:3 crop region:<ul>
     * <li>Crop region: <code>Rect(500, 375, 1500, 1125)</code></li>
     * <li><img alt="Square output, 4:3 aspect ratio crop diagram" src="../images/camera2/metadata/android.scaler.cropRegion/crop-region-43-square-ratio.png" /></li>
     * <li><code>1024x1024</code> stream source area: <code>(625, 375, 1375, 1125)</code> (pillarboxed)</li>
     * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li>
     * <li>Note that in this case, neither of the two outputs is a subset of the other, with
     *   each containing image data the other doesn't have.</li>
     * </ul>
     * </li>
     * </ul>
     * <p>If the coordinate system is ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE, the width and height
     * of the crop region cannot be set to be smaller than
     * <code>floor( activeArraySize.width / ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM )</code> and
@@ -3320,23 +3362,22 @@ typedef enum acamera_metadata_tag {
     * and
     * <code>floor( preCorrectionActiveArraySize.height / ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM )</code>,
     * respectively.</p>
     * <p>The camera device may adjust the crop region to account
     * for rounding and other hardware requirements; the final
     * crop region used will be included in the output capture
     * result.</p>
     * <p>The camera device may adjust the crop region to account for rounding and other hardware
     * requirements; the final crop region used will be included in the output capture result.</p>
     * <p>Starting from API level 30, it's strongly recommended to use ACAMERA_CONTROL_ZOOM_RATIO
     * to take advantage of better support for zoom with logical multi-camera. The benefits
     * include better precision with optical-digital zoom combination, and ability to do
     * zoom-out from 1.0x. When using ACAMERA_CONTROL_ZOOM_RATIO for zoom, the crop region in
     * the capture request must be either letterboxing or pillarboxing (but not both). The
     * coordinate system is post-zoom, meaning that the activeArraySize or
     * preCorrectionActiveArraySize covers the camera device's field of view "after" zoom.
     * See ACAMERA_CONTROL_ZOOM_RATIO for details.</p>
     * preCorrectionActiveArraySize covers the camera device's field of view "after" zoom.  See
     * ACAMERA_CONTROL_ZOOM_RATIO for details.</p>
     * <p>The data representation is int[4], which maps to (left, top, width, height).</p>
     *
     * @see ACAMERA_CONTROL_ZOOM_RATIO
     * @see ACAMERA_DISTORTION_CORRECTION_MODE
     * @see ACAMERA_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM
     * @see ACAMERA_SCALER_CROPPING_TYPE
     * @see ACAMERA_SENSOR_INFO_ACTIVE_ARRAY_SIZE
     * @see ACAMERA_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
     */
+4 −3
Original line number Diff line number Diff line
@@ -886,7 +886,7 @@ status_t AudioFlinger::EffectModule::configure()
    mConfig.outputCfg.format = EFFECT_BUFFER_FORMAT;

    // Don't use sample rate for thread if effect isn't offloadable.
    if (mCallback->isOffload() && !isOffloaded()) {
    if (mCallback->isOffloadOrDirect() && !isOffloaded()) {
        mConfig.inputCfg.samplingRate = DEFAULT_OUTPUT_SAMPLE_RATE;
        ALOGV("Overriding effect input as 48kHz");
    } else {
@@ -1830,12 +1830,13 @@ status_t AudioFlinger::EffectHandle::command(uint32_t cmdCode,
            }

            // copy to local memory in case of client corruption b/32220769
            param = (effect_param_t *)realloc(param, size);
            if (param == NULL) {
            auto *newParam = (effect_param_t *)realloc(param, size);
            if (newParam == NULL) {
                ALOGW("command(): out of memory");
                status = NO_MEMORY;
                break;
            }
            param = newParam;
            memcpy(param, p, size);

            int reply = 0;
+2 −1
Original line number Diff line number Diff line
@@ -5338,7 +5338,8 @@ DeviceVector AudioPolicyManager::getNewOutputDevices(const sp<SwAudioOutputDescr
        auto attr = mEngine->getAllAttributesForProductStrategy(productStrategy).front();

        if ((hasVoiceStream(streams) &&
             (isInCall() || mOutputs.isStrategyActiveOnSameModule(productStrategy, outputDesc))) ||
             (isInCall() || mOutputs.isStrategyActiveOnSameModule(productStrategy, outputDesc)) &&
             !isStreamActive(AUDIO_STREAM_ENFORCED_AUDIBLE, 0)) ||
             ((hasStream(streams, AUDIO_STREAM_ALARM) || hasStream(streams, AUDIO_STREAM_ENFORCED_AUDIBLE)) &&
                mOutputs.isStrategyActiveOnSameModule(productStrategy, outputDesc)) ||
                outputDesc->isStrategyActive(productStrategy)) {
+17 −12
Original line number Diff line number Diff line
@@ -363,12 +363,17 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr,
        return NO_INIT;
    }

    audio_source_t inputSource = attr->source;
    if (inputSource == AUDIO_SOURCE_DEFAULT) {
        inputSource = AUDIO_SOURCE_MIC;
    }

    // already checked by client, but double-check in case the client wrapper is bypassed
    if ((attr->source < AUDIO_SOURCE_DEFAULT)
            || (attr->source >= AUDIO_SOURCE_CNT
                && attr->source != AUDIO_SOURCE_HOTWORD
                && attr->source != AUDIO_SOURCE_FM_TUNER
                && attr->source != AUDIO_SOURCE_ECHO_REFERENCE)) {
    if ((inputSource < AUDIO_SOURCE_DEFAULT)
            || (inputSource >= AUDIO_SOURCE_CNT
                && inputSource != AUDIO_SOURCE_HOTWORD
                && inputSource != AUDIO_SOURCE_FM_TUNER
                && inputSource != AUDIO_SOURCE_ECHO_REFERENCE)) {
        return BAD_VALUE;
    }

@@ -399,17 +404,17 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr,
    }

    bool canCaptureOutput = captureAudioOutputAllowed(pid, uid);
    if ((attr->source == AUDIO_SOURCE_VOICE_UPLINK ||
        attr->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
        attr->source == AUDIO_SOURCE_VOICE_CALL ||
        attr->source == AUDIO_SOURCE_ECHO_REFERENCE||
        attr->source == AUDIO_SOURCE_FM_TUNER) &&
    if ((inputSource == AUDIO_SOURCE_VOICE_UPLINK ||
        inputSource == AUDIO_SOURCE_VOICE_DOWNLINK ||
        inputSource == AUDIO_SOURCE_VOICE_CALL ||
        inputSource == AUDIO_SOURCE_ECHO_REFERENCE||
        inputSource == AUDIO_SOURCE_FM_TUNER) &&
        !canCaptureOutput) {
        return PERMISSION_DENIED;
    }

    bool canCaptureHotword = captureHotwordAllowed(opPackageName, pid, uid);
    if ((attr->source == AUDIO_SOURCE_HOTWORD) && !canCaptureHotword) {
    if ((inputSource == AUDIO_SOURCE_HOTWORD) && !canCaptureHotword) {
        return BAD_VALUE;
    }

@@ -474,7 +479,7 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr,

    if (audioPolicyEffects != 0) {
        // create audio pre processors according to input source
        status_t status = audioPolicyEffects->addInputEffects(*input, attr->source, session);
        status_t status = audioPolicyEffects->addInputEffects(*input, inputSource, session);
        if (status != NO_ERROR && status != ALREADY_EXISTS) {
            ALOGW("Failed to add effects on input %d", *input);
        }