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

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

Snap for 6378851 from 0428fecb to rvc-release

Change-Id: Ibb6085c638791f4888630a32ef59c8b7aeea21b1
parents 0b123d54 0428fecb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ const sp<IAudioFlinger> AudioSystem::get_audio_flinger()
{
    sp<IAudioFlinger> af;
    sp<AudioFlingerClient> afc;
    bool reportNoError = false;
    {
        Mutex::Autolock _l(gLock);
        if (gAudioFlinger == 0) {
@@ -70,7 +71,7 @@ const sp<IAudioFlinger> AudioSystem::get_audio_flinger()
            if (gAudioFlingerClient == NULL) {
                gAudioFlingerClient = new AudioFlingerClient();
            } else {
                reportError(NO_ERROR);
                reportNoError = true;
            }
            binder->linkToDeath(gAudioFlingerClient);
            gAudioFlinger = interface_cast<IAudioFlinger>(binder);
@@ -86,6 +87,7 @@ const sp<IAudioFlinger> AudioSystem::get_audio_flinger()
        af->registerClient(afc);
        IPCThreadState::self()->restoreCallingIdentity(token);
    }
    if (reportNoError) reportError(NO_ERROR);
    return af;
}

+52 −28
Original line number Diff line number Diff line
@@ -445,13 +445,33 @@ status_t TextDescriptions::extract3GPPGlobalDescriptions(
                    | *(tmpData + 10) << 8 | *(tmpData + 11);
                parcel->writeInt32(rgba);

                // tx3g box contains class FontTableBox() which extends ftab box
                // This information is part of the 3gpp Timed Text Format
                // Specification#: 26.245 / Section: 5.16(Sample Description Format)
                // https://www.3gpp.org/ftp/Specs/archive/26_series/26.245/

                tmpData += 12;
                remaining -= 12;

                if (remaining < 2) {
                if (remaining < 8) {
                    return OK;
                }

                size_t subChunkSize = U32_AT(tmpData);
                if(remaining < subChunkSize) {
                    return OK;
                }

                uint32_t subChunkType = U32_AT(tmpData + 4);

                if (subChunkType == FOURCC('f', 't', 'a', 'b'))
                {
                    tmpData += 8;
                    size_t subChunkRemaining = subChunkSize - 8;

                    if(subChunkRemaining < 2) {
                        return OK;
                    }
                    size_t dataPos = parcel->dataPosition();

                    parcel->writeInt32(KEY_STRUCT_FONT_LIST);
@@ -459,10 +479,10 @@ status_t TextDescriptions::extract3GPPGlobalDescriptions(
                    parcel->writeInt32(count);

                    tmpData += 2;
                remaining -= 2;
                    subChunkRemaining -= 2;

                    for (int i = 0; i < count; i++) {
                    if (remaining < 3) {
                        if (subChunkRemaining < 3) {
                            // roll back
                            parcel->setDataPosition(dataPos);
                            return OK;
@@ -471,14 +491,14 @@ status_t TextDescriptions::extract3GPPGlobalDescriptions(
                        parcel->writeInt32(U16_AT(tmpData));

                        // font name length
                    parcel->writeInt32(*(tmpData + 2));

                        size_t len = *(tmpData + 2);

                        parcel->writeInt32(len);

                        tmpData += 3;
                    remaining -= 3;
                        subChunkRemaining -=3;

                    if (remaining < len) {
                        if (subChunkRemaining < len) {
                            // roll back
                            parcel->setDataPosition(dataPos);
                            return OK;
@@ -486,10 +506,14 @@ status_t TextDescriptions::extract3GPPGlobalDescriptions(

                        parcel->write(tmpData, len);
                        tmpData += len;
                    remaining -= len;
                        subChunkRemaining -= len;
                    }
                    tmpData += subChunkRemaining;
                    remaining -= subChunkSize;
                } else {
                    tmpData += subChunkSize;
                    remaining -= subChunkSize;
                }

                // there is a "DisparityBox" after this according to the spec, but we ignore it
                break;
            }
            default:
+6 −7
Original line number Diff line number Diff line
@@ -841,13 +841,6 @@ status_t CameraProviderManager::ProviderInfo::DeviceInfo3::addDynamicDepthTags()
        itDuration++; itSize++;
    }

    c.update(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS,
            dynamicDepthEntries.data(), dynamicDepthEntries.size());
    c.update(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS,
            dynamicDepthMinDurationEntries.data(), dynamicDepthMinDurationEntries.size());
    c.update(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS,
            dynamicDepthStallDurationEntries.data(), dynamicDepthStallDurationEntries.size());

    std::vector<int32_t> supportedChTags;
    supportedChTags.reserve(chTags.count + 3);
    supportedChTags.insert(supportedChTags.end(), chTags.data.i32,
@@ -855,6 +848,12 @@ status_t CameraProviderManager::ProviderInfo::DeviceInfo3::addDynamicDepthTags()
    supportedChTags.push_back(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS);
    supportedChTags.push_back(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS);
    supportedChTags.push_back(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS);
    c.update(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS,
            dynamicDepthEntries.data(), dynamicDepthEntries.size());
    c.update(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS,
            dynamicDepthMinDurationEntries.data(), dynamicDepthMinDurationEntries.size());
    c.update(ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS,
            dynamicDepthStallDurationEntries.data(), dynamicDepthStallDurationEntries.size());
    c.update(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, supportedChTags.data(),
            supportedChTags.size());

+2 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ LOCAL_C_INCLUDES += \

LOCAL_CFLAGS += -Wall -Wextra -Werror

LOCAL_SANITIZE := address

LOCAL_MODULE:= cameraservice_test
LOCAL_COMPATIBILITY_SUITE := device-tests
LOCAL_MODULE_TAGS := tests
+61 −2
Original line number Diff line number Diff line
@@ -40,8 +40,15 @@ using android::hardware::camera::provider::V2_5::DeviceState;
 */
struct TestDeviceInterface : public device::V3_2::ICameraDevice {
    std::vector<hardware::hidl_string> mDeviceNames;
    android::hardware::hidl_vec<uint8_t> mCharacteristics;

    TestDeviceInterface(std::vector<hardware::hidl_string> deviceNames,
            android::hardware::hidl_vec<uint8_t> chars) :
        mDeviceNames(deviceNames), mCharacteristics(chars) {}

    TestDeviceInterface(std::vector<hardware::hidl_string> deviceNames) :
        mDeviceNames(deviceNames) {}

    using getResourceCost_cb = std::function<void(
            hardware::camera::common::V1_0::Status status,
            const hardware::camera::common::V1_0::CameraResourceCost& resourceCost)>;
@@ -58,8 +65,7 @@ struct TestDeviceInterface : public device::V3_2::ICameraDevice {
            const hardware::hidl_vec<uint8_t>& cameraCharacteristics)>;
    hardware::Return<void> getCameraCharacteristics(
            getCameraCharacteristics_cb _hidl_cb) override {
        hardware::hidl_vec<uint8_t> cameraCharacteristics;
        _hidl_cb(Status::OK, cameraCharacteristics);
        _hidl_cb(Status::OK, mCharacteristics);
        return hardware::Void();
    }

@@ -100,6 +106,13 @@ struct TestICameraProvider : virtual public provider::V2_5::ICameraProvider {
        mDeviceInterface(new TestDeviceInterface(devices)),
        mVendorTagSections (vendorSection) {}

    TestICameraProvider(const std::vector<hardware::hidl_string> &devices,
            const hardware::hidl_vec<common::V1_0::VendorTagSection> &vendorSection,
            android::hardware::hidl_vec<uint8_t> chars) :
        mDeviceNames(devices),
        mDeviceInterface(new TestDeviceInterface(devices, chars)),
        mVendorTagSections (vendorSection) {}

    virtual hardware::Return<Status> setCallback(
            const sp<provider::V2_4::ICameraProviderCallback>& callbacks) override {
        mCalledCounter[SET_CALLBACK]++;
@@ -243,6 +256,52 @@ struct TestStatusListener : public CameraProviderManager::StatusListener {
    void onNewProviderRegistered() override {}
};

TEST(CameraProviderManagerTest, InitializeDynamicDepthTest) {
    std::vector<hardware::hidl_string> deviceNames;
    deviceNames.push_back("device@3.2/test/0");
    hardware::hidl_vec<common::V1_0::VendorTagSection> vendorSection;
    status_t res;
    sp<CameraProviderManager> providerManager = new CameraProviderManager();
    sp<TestStatusListener> statusListener = new TestStatusListener();
    TestInteractionProxy serviceProxy;

    android::hardware::hidl_vec<uint8_t> chars;
    CameraMetadata meta;
    int32_t charKeys[] = { ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE,
            ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS };
    meta.update(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, charKeys,
            sizeof(charKeys) / sizeof(charKeys[0]));
    uint8_t depthIsExclusive = ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE;
    meta.update(ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE, &depthIsExclusive, 1);
    int32_t sizes[] = { HAL_PIXEL_FORMAT_BLOB,
            640, 480, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT };
    meta.update(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, sizes,
            sizeof(sizes) / sizeof(sizes[0]));
    sizes[0] = HAL_PIXEL_FORMAT_Y16;
    meta.update(ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, sizes,
            sizeof(sizes) / sizeof(sizes[0]));
    int64_t durations[] = { HAL_PIXEL_FORMAT_BLOB, 640, 480, 0 };
    meta.update(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS, durations,
            sizeof(durations) / sizeof(durations[0]));
    meta.update(ANDROID_SCALER_AVAILABLE_STALL_DURATIONS, durations,
            sizeof(durations) / sizeof(durations[0]));
    durations[0]= HAL_PIXEL_FORMAT_Y16;
    meta.update(ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS, durations,
            sizeof(durations) / sizeof(durations[0]));
    meta.update(ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS, durations,
            sizeof(durations) / sizeof(durations[0]));
    camera_metadata_t* metaBuffer = const_cast<camera_metadata_t*>(meta.getAndLock());
    chars.setToExternal(reinterpret_cast<uint8_t*>(metaBuffer),
            get_camera_metadata_size(metaBuffer));

    sp<TestICameraProvider> provider =  new TestICameraProvider(deviceNames,
            vendorSection, chars);
    serviceProxy.setProvider(provider);

    res = providerManager->initialize(statusListener, &serviceProxy);
    ASSERT_EQ(res, OK) << "Unable to initialize provider manager";
}

TEST(CameraProviderManagerTest, InitializeTest) {
    std::vector<hardware::hidl_string> deviceNames;
    deviceNames.push_back("device@3.2/test/0");
Loading