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

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

Snap for 6479434 from 6af52312 to mainline-release

Change-Id: I80cda425313e663745932eabfbd113c85d8942e1
parents a66ac451 6af52312
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -139,20 +139,18 @@ status_t BnCameraClient::onTransact(
            CHECK_INTERFACE(ICameraClient, data, reply);
            int32_t msgType = data.readInt32();
            sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
            camera_frame_metadata_t *metadata = NULL;
            camera_frame_metadata_t metadata;
            if (data.dataAvail() > 0) {
                metadata = new camera_frame_metadata_t;
                metadata->number_of_faces = data.readInt32();
                if (metadata->number_of_faces <= 0 ||
                        metadata->number_of_faces > (int32_t)(INT32_MAX / sizeof(camera_face_t))) {
                    ALOGE("%s: Too large face count: %d", __FUNCTION__, metadata->number_of_faces);
                metadata.number_of_faces = data.readInt32();
                if (metadata.number_of_faces <= 0 ||
                        metadata.number_of_faces > (int32_t)(INT32_MAX / sizeof(camera_face_t))) {
                    ALOGE("%s: Too large face count: %d", __FUNCTION__, metadata.number_of_faces);
                    return BAD_VALUE;
                }
                metadata->faces = (camera_face_t *) data.readInplace(
                        sizeof(camera_face_t) * metadata->number_of_faces);
                metadata.faces = (camera_face_t *) data.readInplace(
                        sizeof(camera_face_t) * metadata.number_of_faces);
            }
            dataCallback(msgType, imageData, metadata);
            if (metadata) delete metadata;
            dataCallback(msgType, imageData, &metadata);
            return NO_ERROR;
        } break;
        case DATA_CALLBACK_TIMESTAMP: {
+29 −0
Original line number Diff line number Diff line
@@ -80,9 +80,28 @@ void DeviceDescriptorBase::toAudioPort(struct audio_port *port) const
    toAudioPortConfig(&port->active_config);
    port->id = mId;
    port->ext.device.type = mDeviceTypeAddr.mType;
    port->ext.device.encapsulation_modes = mEncapsulationModes;
    port->ext.device.encapsulation_metadata_types = mEncapsulationMetadataTypes;
    (void)audio_utils_strlcpy_zerofill(port->ext.device.address, mDeviceTypeAddr.getAddress());
}

status_t DeviceDescriptorBase::setEncapsulationModes(uint32_t encapsulationModes) {
    if ((encapsulationModes & ~AUDIO_ENCAPSULATION_MODE_ALL_POSITION_BITS) != 0) {
        return BAD_VALUE;
    }
    mEncapsulationModes = encapsulationModes & ~(1 << AUDIO_ENCAPSULATION_MODE_NONE);
    return NO_ERROR;
}

status_t DeviceDescriptorBase::setEncapsulationMetadataTypes(uint32_t encapsulationMetadataTypes) {
    if ((encapsulationMetadataTypes & ~AUDIO_ENCAPSULATION_METADATA_TYPE_ALL_POSITION_BITS) != 0) {
        return BAD_VALUE;
    }
    mEncapsulationMetadataTypes =
            encapsulationMetadataTypes & ~(1 << AUDIO_ENCAPSULATION_METADATA_TYPE_NONE);
    return NO_ERROR;
}

void DeviceDescriptorBase::dump(std::string *dst, int spaces, int index,
                                const char* extraInfo, bool verbose) const
{
@@ -98,6 +117,12 @@ void DeviceDescriptorBase::dump(std::string *dst, int spaces, int index,
    dst->append(base::StringPrintf("%*s- type: %-48s\n",
            spaces, "", ::android::toString(mDeviceTypeAddr.mType).c_str()));

    dst->append(base::StringPrintf(
            "%*s- supported encapsulation modes: %u", spaces, "", mEncapsulationModes));
    dst->append(base::StringPrintf(
            "%*s- supported encapsulation metadata types: %u",
            spaces, "", mEncapsulationMetadataTypes));

    if (mDeviceTypeAddr.mAddress.size() != 0) {
        dst->append(base::StringPrintf(
                "%*s- address: %-32s\n", spaces, "", mDeviceTypeAddr.getAddress()));
@@ -135,6 +160,8 @@ status_t DeviceDescriptorBase::writeToParcel(Parcel *parcel) const
    if ((status = AudioPort::writeToParcel(parcel)) != NO_ERROR) return status;
    if ((status = AudioPortConfig::writeToParcel(parcel)) != NO_ERROR) return status;
    if ((status = parcel->writeParcelable(mDeviceTypeAddr)) != NO_ERROR) return status;
    if ((status = parcel->writeUint32(mEncapsulationModes)) != NO_ERROR) return status;
    if ((status = parcel->writeUint32(mEncapsulationMetadataTypes)) != NO_ERROR) return status;
    return status;
}

@@ -144,6 +171,8 @@ status_t DeviceDescriptorBase::readFromParcel(const Parcel *parcel)
    if ((status = AudioPort::readFromParcel(parcel)) != NO_ERROR) return status;
    if ((status = AudioPortConfig::readFromParcel(parcel)) != NO_ERROR) return status;
    if ((status = parcel->readParcelable(&mDeviceTypeAddr)) != NO_ERROR) return status;
    if ((status = parcel->readUint32(&mEncapsulationModes)) != NO_ERROR) return status;
    if ((status = parcel->readUint32(&mEncapsulationMetadataTypes)) != NO_ERROR) return status;
    return status;
}

+5 −0
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ public:
    // AudioPort
    virtual void toAudioPort(struct audio_port *port) const;

    status_t setEncapsulationModes(uint32_t encapsulationModes);
    status_t setEncapsulationMetadataTypes(uint32_t encapsulationMetadataTypes);

    void dump(std::string *dst, int spaces, int index,
              const char* extraInfo = nullptr, bool verbose = true) const;
    void log() const;
@@ -67,6 +70,8 @@ public:

protected:
    AudioDeviceTypeAddr mDeviceTypeAddr;
    uint32_t mEncapsulationModes = 0;
    uint32_t mEncapsulationMetadataTypes = 0;
};

using DeviceDescriptorBaseVector = std::vector<sp<DeviceDescriptorBase>>;
+3 −0
Original line number Diff line number Diff line
@@ -131,6 +131,9 @@ TEST(AudioFoundationParcelableTest, ParcelingDeviceDescriptorBase) {
    desc->setAudioProfiles(getAudioProfileVectorForTest());
    desc->applyAudioPortConfig(&TEST_AUDIO_PORT_CONFIG);
    desc->setAddress("DeviceDescriptorBaseTestAddress");
    ASSERT_EQ(desc->setEncapsulationModes(1 << AUDIO_ENCAPSULATION_MODE_HANDLE), NO_ERROR);
    ASSERT_EQ(desc->setEncapsulationMetadataTypes(
            AUDIO_ENCAPSULATION_METADATA_TYPE_ALL_POSITION_BITS), NO_ERROR);

    ASSERT_EQ(data.writeParcelable(*desc), NO_ERROR);
    data.setDataPosition(0);
+13 −4
Original line number Diff line number Diff line
@@ -41,16 +41,25 @@ status_t ConversionHelperHidl::keysFromHal(const String8& keys, hidl_vec<hidl_st
    bool keepFormatValue = halKeys.size() == 2 &&
         (halKeys.get(String8(AudioParameter::keyStreamSupportedChannels), value) == NO_ERROR ||
         halKeys.get(String8(AudioParameter::keyStreamSupportedSamplingRates), value) == NO_ERROR);
    // When querying encapsulation capabilities, "keyRouting=<value>" pair is used to identify
    // the device. We need to transform it into a single key string so that it is carried over to
    // the legacy HAL via HIDL.
    bool keepRoutingValue =
            halKeys.get(String8(AUDIO_PARAMETER_DEVICE_SUP_ENCAPSULATION_MODES),
                        value) == NO_ERROR ||
            halKeys.get(String8(AUDIO_PARAMETER_DEVICE_SUP_ENCAPSULATION_METADATA_TYPES),
                        value) == NO_ERROR;

    for (size_t i = 0; i < halKeys.size(); ++i) {
        String8 key;
        status_t status = halKeys.getAt(i, key);
        if (status != OK) return status;
        if (keepFormatValue && key == AudioParameter::keyFormat) {
            AudioParameter formatParam;
        if ((keepFormatValue && key == AudioParameter::keyFormat) ||
            (keepRoutingValue && key == AudioParameter::keyRouting)) {
            AudioParameter keepValueParam;
            halKeys.getAt(i, key, value);
            formatParam.add(key, value);
            key = formatParam.toString();
            keepValueParam.add(key, value);
            key = keepValueParam.toString();
        }
        (*hidlKeys)[i] = key.string();
    }
Loading