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

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

Snap for 6315035 from 2a0dd3f1 to mainline-release

Change-Id: I43e2ddcaed9fe427516847fa7d007ceae059a824
parents 701199d1 2a0dd3f1
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -527,7 +527,6 @@ ACameraMetadata::isCaptureRequestTag(const uint32_t tag) {
        case ACAMERA_LENS_OPTICAL_STABILIZATION_MODE:
        case ACAMERA_LENS_OPTICAL_STABILIZATION_MODE:
        case ACAMERA_NOISE_REDUCTION_MODE:
        case ACAMERA_NOISE_REDUCTION_MODE:
        case ACAMERA_SCALER_CROP_REGION:
        case ACAMERA_SCALER_CROP_REGION:
        case ACAMERA_SCALER_ROTATE_AND_CROP:
        case ACAMERA_SENSOR_EXPOSURE_TIME:
        case ACAMERA_SENSOR_EXPOSURE_TIME:
        case ACAMERA_SENSOR_FRAME_DURATION:
        case ACAMERA_SENSOR_FRAME_DURATION:
        case ACAMERA_SENSOR_SENSITIVITY:
        case ACAMERA_SENSOR_SENSITIVITY:
+0 −147
Original line number Original line Diff line number Diff line
@@ -3690,108 +3690,6 @@ typedef enum acamera_metadata_tag {
    ACAMERA_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP = 
    ACAMERA_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP = 
                                                                // int32
                                                                // int32
            ACAMERA_SCALER_START + 15,
            ACAMERA_SCALER_START + 15,
    /**
     * <p>List of rotate-and-crop modes for ACAMERA_SCALER_ROTATE_AND_CROP that are supported by this camera device.</p>
     *
     * @see ACAMERA_SCALER_ROTATE_AND_CROP
     *
     * <p>Type: byte[n]</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>This entry lists the valid modes for ACAMERA_SCALER_ROTATE_AND_CROP for this camera device.</p>
     * <p>Starting with API level 30, all devices will list at least <code>ROTATE_AND_CROP_NONE</code>.
     * Devices with support for rotate-and-crop will additionally list at least
     * <code>ROTATE_AND_CROP_AUTO</code> and <code>ROTATE_AND_CROP_90</code>.</p>
     *
     * @see ACAMERA_SCALER_ROTATE_AND_CROP
     */
    ACAMERA_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES =            // byte[n]
            ACAMERA_SCALER_START + 16,
    /**
     * <p>Whether a rotation-and-crop operation is applied to processed
     * outputs from the camera.</p>
     *
     * <p>Type: byte (acamera_metadata_enum_android_scaler_rotate_and_crop_t)</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks</li>
     *   <li>ACaptureRequest</li>
     * </ul></p>
     *
     * <p>This control is primarily intended to help camera applications with no support for
     * multi-window modes to work correctly on devices where multi-window scenarios are
     * unavoidable, such as foldables or other devices with variable display geometry or more
     * free-form window placement (such as laptops, which often place portrait-orientation apps
     * in landscape with pillarboxing).</p>
     * <p>If supported, the default value is <code>ROTATE_AND_CROP_AUTO</code>, which allows the camera API
     * to enable backwards-compatibility support for applications that do not support resizing
     * / multi-window modes, when the device is in fact in a multi-window mode (such as inset
     * portrait on laptops, or on a foldable device in some fold states).  In addition,
     * <code>ROTATE_AND_CROP_NONE</code> and <code>ROTATE_AND_CROP_90</code> will always be available if this control
     * is supported by the device.  If not supported, devices API level 30 or higher will always
     * list only <code>ROTATE_AND_CROP_NONE</code>.</p>
     * <p>When <code>CROP_AUTO</code> is in use, and the camera API activates backward-compatibility mode,
     * several metadata fields will also be parsed differently to ensure that coordinates are
     * correctly handled for features like drawing face detection boxes or passing in
     * tap-to-focus coordinates.  The camera API will convert positions in the active array
     * coordinate system to/from the cropped-and-rotated coordinate system to make the
     * operation transparent for applications.  The following controls are affected:</p>
     * <ul>
     * <li>ACAMERA_CONTROL_AE_REGIONS</li>
     * <li>ACAMERA_CONTROL_AF_REGIONS</li>
     * <li>ACAMERA_CONTROL_AWB_REGIONS</li>
     * <li>android.statistics.faces</li>
     * </ul>
     * <p>Capture results will contain the actual value selected by the API;
     * <code>ROTATE_AND_CROP_AUTO</code> will never be seen in a capture result.</p>
     * <p>Applications can also select their preferred cropping mode, either to opt out of the
     * backwards-compatibility treatment, or to use the cropping feature themselves as needed.
     * In this case, no coordinate translation will be done automatically, and all controls
     * will continue to use the normal active array coordinates.</p>
     * <p>Cropping and rotating is done after the application of digital zoom (via either
     * ACAMERA_SCALER_CROP_REGION or ACAMERA_CONTROL_ZOOM_RATIO), but before each individual
     * output is further cropped and scaled. It only affects processed outputs such as
     * YUV, PRIVATE, and JPEG.  It has no effect on RAW outputs.</p>
     * <p>When <code>CROP_90</code> or <code>CROP_270</code> are selected, there is a significant loss to the field of
     * view. For example, with a 4:3 aspect ratio output of 1600x1200, <code>CROP_90</code> will still
     * produce 1600x1200 output, but these buffers are cropped from a vertical 3:4 slice at the
     * center of the 4:3 area, then rotated to be 4:3, and then upscaled to 1600x1200.  Only
     * 56.25% of the original FOV is still visible.  In general, for an aspect ratio of <code>w:h</code>,
     * the crop and rotate operation leaves <code>(h/w)^2</code> of the field of view visible. For 16:9,
     * this is ~31.6%.</p>
     * <p>As a visual example, the figure below shows the effect of <code>ROTATE_AND_CROP_90</code> on the
     * outputs for the following parameters:</p>
     * <ul>
     * <li>Sensor active array: <code>2000x1500</code></li>
     * <li>Crop region: top-left: <code>(500, 375)</code>, size: <code>(1000, 750)</code> (4:3 aspect ratio)</li>
     * <li>Output streams: YUV <code>640x480</code> and YUV <code>1280x720</code></li>
     * <li><code>ROTATE_AND_CROP_90</code></li>
     * </ul>
     * <p><img alt="Effect of ROTATE_AND_CROP_90" src="../images/camera2/metadata/android.scaler.rotateAndCrop/crop-region-rotate-90-43-ratio.png" /></p>
     * <p>With these settings, the regions of the active array covered by the output streams are:</p>
     * <ul>
     * <li>640x480 stream crop: top-left: <code>(219, 375)</code>, size: <code>(562, 750)</code></li>
     * <li>1280x720 stream crop: top-left: <code>(289, 375)</code>, size: <code>(422, 750)</code></li>
     * </ul>
     * <p>Since the buffers are rotated, the buffers as seen by the application are:</p>
     * <ul>
     * <li>640x480 stream: top-left: <code>(781, 375)</code> on active array, size: <code>(640, 480)</code>, downscaled 1.17x from sensor pixels</li>
     * <li>1280x720 stream: top-left: <code>(711, 375)</code> on active array, size: <code>(1280, 720)</code>, upscaled 1.71x from sensor pixels</li>
     * </ul>
     *
     * @see ACAMERA_CONTROL_AE_REGIONS
     * @see ACAMERA_CONTROL_AF_REGIONS
     * @see ACAMERA_CONTROL_AWB_REGIONS
     * @see ACAMERA_CONTROL_ZOOM_RATIO
     * @see ACAMERA_SCALER_CROP_REGION
     */
    ACAMERA_SCALER_ROTATE_AND_CROP =                            // byte (acamera_metadata_enum_android_scaler_rotate_and_crop_t)
            ACAMERA_SCALER_START + 17,
    ACAMERA_SCALER_END,
    ACAMERA_SCALER_END,


    /**
    /**
@@ -8314,51 +8212,6 @@ typedef enum acamera_metadata_enum_acamera_scaler_available_recommended_stream_c


} acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t;
} acamera_metadata_enum_android_scaler_available_recommended_stream_configurations_t;


// ACAMERA_SCALER_ROTATE_AND_CROP
typedef enum acamera_metadata_enum_acamera_scaler_rotate_and_crop {
    /**
     * <p>No rotate and crop is applied. Processed outputs are in the sensor orientation.</p>
     */
    ACAMERA_SCALER_ROTATE_AND_CROP_NONE                              = 0,

    /**
     * <p>Processed images are rotated by 90 degrees clockwise, and then cropped
     * to the original aspect ratio.</p>
     */
    ACAMERA_SCALER_ROTATE_AND_CROP_90                                = 1,

    /**
     * <p>Processed images are rotated by 180 degrees.  Since the aspect ratio does not
     * change, no cropping is performed.</p>
     */
    ACAMERA_SCALER_ROTATE_AND_CROP_180                               = 2,

    /**
     * <p>Processed images are rotated by 270 degrees clockwise, and then cropped
     * to the original aspect ratio.</p>
     */
    ACAMERA_SCALER_ROTATE_AND_CROP_270                               = 3,

    /**
     * <p>The camera API automatically selects the best concrete value for
     * rotate-and-crop based on the application's support for resizability and the current
     * multi-window mode.</p>
     * <p>If the application does not support resizing but the display mode for its main
     * Activity is not in a typical orientation, the camera API will set <code>ROTATE_AND_CROP_90</code>
     * or some other supported rotation value, depending on device configuration,
     * to ensure preview and captured images are correctly shown to the user. Otherwise,
     * <code>ROTATE_AND_CROP_NONE</code> will be selected.</p>
     * <p>When a value other than NONE is selected, several metadata fields will also be parsed
     * differently to ensure that coordinates are correctly handled for features like drawing
     * face detection boxes or passing in tap-to-focus coordinates.  The camera API will
     * convert positions in the active array coordinate system to/from the cropped-and-rotated
     * coordinate system to make the operation transparent for applications.</p>
     * <p>No coordinate mapping will be done when the application selects a non-AUTO mode.</p>
     */
    ACAMERA_SCALER_ROTATE_AND_CROP_AUTO                              = 4,

} acamera_metadata_enum_android_scaler_rotate_and_crop_t;



// ACAMERA_SENSOR_REFERENCE_ILLUMINANT1
// ACAMERA_SENSOR_REFERENCE_ILLUMINANT1
typedef enum acamera_metadata_enum_acamera_sensor_reference_illuminant1 {
typedef enum acamera_metadata_enum_acamera_sensor_reference_illuminant1 {
+3 −2
Original line number Original line Diff line number Diff line
@@ -319,10 +319,11 @@ status_t Codec2InfoBuilder::buildMediaCodecList(MediaCodecListWriter* writer) {
    // Obtain Codec2Client
    // Obtain Codec2Client
    std::vector<Traits> traits = Codec2Client::ListComponents();
    std::vector<Traits> traits = Codec2Client::ListComponents();


    // parse APEX XML first, followed by vendor XML
    // parse APEX XML first, followed by vendor XML.
    // Note: APEX XML names do not depend on ro.media.xml_variant.* properties.
    MediaCodecsXmlParser parser;
    MediaCodecsXmlParser parser;
    parser.parseXmlFilesInSearchDirs(
    parser.parseXmlFilesInSearchDirs(
            parser.getDefaultXmlNames(),
            { "media_codecs.xml", "media_codecs_performance.xml" },
            { "/apex/com.android.media.swcodec/etc" });
            { "/apex/com.android.media.swcodec/etc" });


    // TODO: remove these c2-specific files once product moved to default file names
    // TODO: remove these c2-specific files once product moved to default file names
+40 −16
Original line number Original line Diff line number Diff line
@@ -36,7 +36,7 @@ namespace android {
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------


AudioEffect::AudioEffect(const String16& opPackageName)
AudioEffect::AudioEffect(const String16& opPackageName)
    : mStatus(NO_INIT), mOpPackageName(opPackageName)
    : mStatus(NO_INIT), mProbe(false), mOpPackageName(opPackageName)
{
{
}
}


@@ -49,12 +49,13 @@ AudioEffect::AudioEffect(const effect_uuid_t *type,
                void* user,
                void* user,
                audio_session_t sessionId,
                audio_session_t sessionId,
                audio_io_handle_t io,
                audio_io_handle_t io,
                const AudioDeviceTypeAddr& device
                const AudioDeviceTypeAddr& device,
                bool probe
                )
                )
    : mStatus(NO_INIT), mOpPackageName(opPackageName)
    : mStatus(NO_INIT), mProbe(false), mOpPackageName(opPackageName)
{
{
    AutoMutex lock(mConstructLock);
    AutoMutex lock(mConstructLock);
    mStatus = set(type, uuid, priority, cbf, user, sessionId, io, device);
    mStatus = set(type, uuid, priority, cbf, user, sessionId, io, device, probe);
}
}


AudioEffect::AudioEffect(const char *typeStr,
AudioEffect::AudioEffect(const char *typeStr,
@@ -65,9 +66,10 @@ AudioEffect::AudioEffect(const char *typeStr,
                void* user,
                void* user,
                audio_session_t sessionId,
                audio_session_t sessionId,
                audio_io_handle_t io,
                audio_io_handle_t io,
                const AudioDeviceTypeAddr& device
                const AudioDeviceTypeAddr& device,
                bool probe
                )
                )
    : mStatus(NO_INIT), mOpPackageName(opPackageName)
    : mStatus(NO_INIT), mProbe(false), mOpPackageName(opPackageName)
{
{
    effect_uuid_t type;
    effect_uuid_t type;
    effect_uuid_t *pType = NULL;
    effect_uuid_t *pType = NULL;
@@ -89,7 +91,7 @@ AudioEffect::AudioEffect(const char *typeStr,
    }
    }


    AutoMutex lock(mConstructLock);
    AutoMutex lock(mConstructLock);
    mStatus = set(pType, pUuid, priority, cbf, user, sessionId, io, device);
    mStatus = set(pType, pUuid, priority, cbf, user, sessionId, io, device, probe);
}
}


status_t AudioEffect::set(const effect_uuid_t *type,
status_t AudioEffect::set(const effect_uuid_t *type,
@@ -99,7 +101,8 @@ status_t AudioEffect::set(const effect_uuid_t *type,
                void* user,
                void* user,
                audio_session_t sessionId,
                audio_session_t sessionId,
                audio_io_handle_t io,
                audio_io_handle_t io,
                const AudioDeviceTypeAddr& device)
                const AudioDeviceTypeAddr& device,
                bool probe)
{
{
    sp<IEffect> iEffect;
    sp<IEffect> iEffect;
    sp<IMemory> cblk;
    sp<IMemory> cblk;
@@ -126,7 +129,7 @@ status_t AudioEffect::set(const effect_uuid_t *type,
        ALOGW("Must specify at least type or uuid");
        ALOGW("Must specify at least type or uuid");
        return BAD_VALUE;
        return BAD_VALUE;
    }
    }

    mProbe = probe;
    mPriority = priority;
    mPriority = priority;
    mCbf = cbf;
    mCbf = cbf;
    mUserData = user;
    mUserData = user;
@@ -142,15 +145,18 @@ status_t AudioEffect::set(const effect_uuid_t *type,


    iEffect = audioFlinger->createEffect((effect_descriptor_t *)&mDescriptor,
    iEffect = audioFlinger->createEffect((effect_descriptor_t *)&mDescriptor,
            mIEffectClient, priority, io, mSessionId, device, mOpPackageName, mClientPid,
            mIEffectClient, priority, io, mSessionId, device, mOpPackageName, mClientPid,
            &mStatus, &mId, &enabled);
            probe, &mStatus, &mId, &enabled);


    if (iEffect == 0 || (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS)) {
    // In probe mode, we stop here and return the status: the IEffect interface to
    // audio flinger will not be retained. initCheck() will return the creation status
    // but all other APIs will return invalid operation.
    if (probe || iEffect == 0 || (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS)) {
        char typeBuffer[64], uuidBuffer[64];
        char typeBuffer[64], uuidBuffer[64];
        guidToString(type, typeBuffer, sizeof(typeBuffer));
        guidToString(type, typeBuffer, sizeof(typeBuffer));
        guidToString(uuid, uuidBuffer, sizeof(uuidBuffer));
        guidToString(uuid, uuidBuffer, sizeof(uuidBuffer));
        ALOGE("set(): AudioFlinger could not create effect %s / %s, status: %d",
        ALOGE_IF(!probe, "set(): AudioFlinger could not create effect %s / %s, status: %d",
                typeBuffer, uuidBuffer, mStatus);
                typeBuffer, uuidBuffer, mStatus);
        if (iEffect == 0) {
        if (!probe && iEffect == 0) {
            mStatus = NO_INIT;
            mStatus = NO_INIT;
        }
        }
        return mStatus;
        return mStatus;
@@ -191,7 +197,7 @@ AudioEffect::~AudioEffect()
{
{
    ALOGV("Destructor %p", this);
    ALOGV("Destructor %p", this);


    if (mStatus == NO_ERROR || mStatus == ALREADY_EXISTS) {
    if (!mProbe && (mStatus == NO_ERROR || mStatus == ALREADY_EXISTS)) {
        if (!audio_is_global_session(mSessionId)) {
        if (!audio_is_global_session(mSessionId)) {
            AudioSystem::releaseAudioSessionId(mSessionId, mClientPid);
            AudioSystem::releaseAudioSessionId(mSessionId, mClientPid);
        }
        }
@@ -201,10 +207,10 @@ AudioEffect::~AudioEffect()
        }
        }
        mIEffect.clear();
        mIEffect.clear();
        mCblkMemory.clear();
        mCblkMemory.clear();
    }
    mIEffectClient.clear();
    mIEffectClient.clear();
    IPCThreadState::self()->flushCommands();
    IPCThreadState::self()->flushCommands();
}
}
}




status_t AudioEffect::initCheck() const
status_t AudioEffect::initCheck() const
@@ -226,6 +232,9 @@ bool AudioEffect::getEnabled() const


status_t AudioEffect::setEnabled(bool enabled)
status_t AudioEffect::setEnabled(bool enabled)
{
{
    if (mProbe) {
        return INVALID_OPERATION;
    }
    if (mStatus != NO_ERROR) {
    if (mStatus != NO_ERROR) {
        return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
        return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
    }
    }
@@ -254,6 +263,9 @@ status_t AudioEffect::command(uint32_t cmdCode,
                              uint32_t *replySize,
                              uint32_t *replySize,
                              void *replyData)
                              void *replyData)
{
{
    if (mProbe) {
        return INVALID_OPERATION;
    }
    if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
    if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
        ALOGV("command() bad status %d", mStatus);
        ALOGV("command() bad status %d", mStatus);
        return mStatus;
        return mStatus;
@@ -287,6 +299,9 @@ status_t AudioEffect::command(uint32_t cmdCode,


status_t AudioEffect::setParameter(effect_param_t *param)
status_t AudioEffect::setParameter(effect_param_t *param)
{
{
    if (mProbe) {
        return INVALID_OPERATION;
    }
    if (mStatus != NO_ERROR) {
    if (mStatus != NO_ERROR) {
        return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
        return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
    }
    }
@@ -307,6 +322,9 @@ status_t AudioEffect::setParameter(effect_param_t *param)


status_t AudioEffect::setParameterDeferred(effect_param_t *param)
status_t AudioEffect::setParameterDeferred(effect_param_t *param)
{
{
    if (mProbe) {
        return INVALID_OPERATION;
    }
    if (mStatus != NO_ERROR) {
    if (mStatus != NO_ERROR) {
        return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
        return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
    }
    }
@@ -333,6 +351,9 @@ status_t AudioEffect::setParameterDeferred(effect_param_t *param)


status_t AudioEffect::setParameterCommit()
status_t AudioEffect::setParameterCommit()
{
{
    if (mProbe) {
        return INVALID_OPERATION;
    }
    if (mStatus != NO_ERROR) {
    if (mStatus != NO_ERROR) {
        return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
        return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
    }
    }
@@ -347,6 +368,9 @@ status_t AudioEffect::setParameterCommit()


status_t AudioEffect::getParameter(effect_param_t *param)
status_t AudioEffect::getParameter(effect_param_t *param)
{
{
    if (mProbe) {
        return INVALID_OPERATION;
    }
    if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
    if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
        return mStatus;
        return mStatus;
    }
    }
+4 −1
Original line number Original line Diff line number Diff line
@@ -662,6 +662,7 @@ public:
                                    const AudioDeviceTypeAddr& device,
                                    const AudioDeviceTypeAddr& device,
                                    const String16& opPackageName,
                                    const String16& opPackageName,
                                    pid_t pid,
                                    pid_t pid,
                                    bool probe,
                                    status_t *status,
                                    status_t *status,
                                    int *id,
                                    int *id,
                                    int *enabled)
                                    int *enabled)
@@ -689,6 +690,7 @@ public:
        }
        }
        data.writeString16(opPackageName);
        data.writeString16(opPackageName);
        data.writeInt32((int32_t) pid);
        data.writeInt32((int32_t) pid);
        data.writeInt32(probe ? 1 : 0);


        status_t lStatus = remote()->transact(CREATE_EFFECT, data, &reply);
        status_t lStatus = remote()->transact(CREATE_EFFECT, data, &reply);
        if (lStatus != NO_ERROR) {
        if (lStatus != NO_ERROR) {
@@ -1395,12 +1397,13 @@ status_t BnAudioFlinger::onTransact(
            }
            }
            const String16 opPackageName = data.readString16();
            const String16 opPackageName = data.readString16();
            pid_t pid = (pid_t)data.readInt32();
            pid_t pid = (pid_t)data.readInt32();
            bool probe = data.readInt32() == 1;


            int id = 0;
            int id = 0;
            int enabled = 0;
            int enabled = 0;


            sp<IEffect> effect = createEffect(&desc, client, priority, output, sessionId, device,
            sp<IEffect> effect = createEffect(&desc, client, priority, output, sessionId, device,
                    opPackageName, pid, &status, &id, &enabled);
                    opPackageName, pid, probe, &status, &id, &enabled);
            reply->writeInt32(status);
            reply->writeInt32(status);
            reply->writeInt32(id);
            reply->writeInt32(id);
            reply->writeInt32(enabled);
            reply->writeInt32(enabled);
Loading