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

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

Snap for 8581162 from 74386101 to tm-release

Change-Id: I36c0f3ac569ce7a886c652c8c7a88bb51c59dec8
parents aac1e306 74386101
Loading
Loading
Loading
Loading
+30 −3
Original line number Diff line number Diff line
@@ -19,9 +19,11 @@

#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/automotive/evs/BnEvsEnumeratorStatusCallback.h>
#include <aidl/android/hardware/automotive/evs/BufferDesc.h>
#include <aidl/android/hardware/automotive/evs/CameraDesc.h>
#include <aidl/android/hardware/automotive/evs/CameraParam.h>
#include <aidl/android/hardware/automotive/evs/DeviceStatus.h>
#include <aidl/android/hardware/automotive/evs/DisplayDesc.h>
#include <aidl/android/hardware/automotive/evs/DisplayState.h>
#include <aidl/android/hardware/automotive/evs/EvsEventDesc.h>
@@ -30,6 +32,7 @@
#include <aidl/android/hardware/automotive/evs/IEvsCamera.h>
#include <aidl/android/hardware/automotive/evs/IEvsDisplay.h>
#include <aidl/android/hardware/automotive/evs/IEvsEnumerator.h>
#include <aidl/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.h>
#include <aidl/android/hardware/automotive/evs/IEvsUltrasonicsArray.h>
#include <aidl/android/hardware/automotive/evs/ParameterRange.h>
#include <aidl/android/hardware/automotive/evs/Stream.h>
@@ -77,11 +80,11 @@ typedef struct {
} RawStreamConfig;
constexpr size_t kStreamCfgSz = sizeof(RawStreamConfig) / sizeof(int32_t);

}  // namespace

using ::aidl::android::hardware::automotive::evs::BnEvsEnumeratorStatusCallback;
using ::aidl::android::hardware::automotive::evs::BufferDesc;
using ::aidl::android::hardware::automotive::evs::CameraDesc;
using ::aidl::android::hardware::automotive::evs::CameraParam;
using ::aidl::android::hardware::automotive::evs::DeviceStatus;
using ::aidl::android::hardware::automotive::evs::DisplayDesc;
using ::aidl::android::hardware::automotive::evs::DisplayState;
using ::aidl::android::hardware::automotive::evs::EvsEventDesc;
@@ -90,6 +93,7 @@ using ::aidl::android::hardware::automotive::evs::EvsResult;
using ::aidl::android::hardware::automotive::evs::IEvsCamera;
using ::aidl::android::hardware::automotive::evs::IEvsDisplay;
using ::aidl::android::hardware::automotive::evs::IEvsEnumerator;
using ::aidl::android::hardware::automotive::evs::IEvsEnumeratorStatusCallback;
using ::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray;
using ::aidl::android::hardware::automotive::evs::ParameterRange;
using ::aidl::android::hardware::automotive::evs::Stream;
@@ -99,6 +103,8 @@ using ::aidl::android::hardware::graphics::common::HardwareBufferDescription;
using ::aidl::android::hardware::graphics::common::PixelFormat;
using std::chrono_literals::operator""s;

}  // namespace

// The main test class for EVS
class EvsAidlTest : public ::testing::TestWithParam<std::string> {
  public:
@@ -239,6 +245,13 @@ class EvsAidlTest : public ::testing::TestWithParam<std::string> {
        return targetCfg;
    }

    class DeviceStatusCallback : public BnEvsEnumeratorStatusCallback {
        ndk::ScopedAStatus deviceStatusChanged(const std::vector<DeviceStatus>&) override {
            // This empty implementation returns always ok().
            return ndk::ScopedAStatus::ok();
        }
    };

    // Every test needs access to the service
    std::shared_ptr<IEvsEnumerator> mEnumerator;
    // Empty unless/util loadCameraList() is called
@@ -528,7 +541,7 @@ TEST_P(EvsAidlTest, CameraStreamBuffering) {
        // Ask for a very large number of buffers in flight to ensure it errors correctly
        auto badResult = pCam->setMaxFramesInFlight(std::numeric_limits<int32_t>::max());
        EXPECT_TRUE(!badResult.isOk() && badResult.getServiceSpecificError() ==
                                                 static_cast<int>(EvsResult::INVALID_ARG));
                                                 static_cast<int>(EvsResult::BUFFER_NOT_AVAILABLE));

        // Now ask for exactly two buffers in flight as we'll test behavior in that case
        ASSERT_TRUE(pCam->setMaxFramesInFlight(kBuffersToHold).isOk());
@@ -2064,6 +2077,20 @@ TEST_P(EvsAidlTest, CameraStreamExternalBuffering) {
    }
}

TEST_P(EvsAidlTest, DeviceStatusCallbackRegistration) {
    std::shared_ptr<IEvsEnumeratorStatusCallback> cb =
            ndk::SharedRefBase::make<DeviceStatusCallback>();
    ndk::ScopedAStatus status = mEnumerator->registerStatusCallback(cb);
    if (mIsHwModule) {
        ASSERT_TRUE(status.isOk());
    } else {
        // A callback registration may fail if a HIDL EVS HAL implementation is
        // running.
        ASSERT_TRUE(status.isOk() ||
                    status.getServiceSpecificError() == static_cast<int>(EvsResult::NOT_SUPPORTED));
    }
}

/*
 * UltrasonicsArrayOpenClean:
 * Opens each ultrasonics arrays reported by the enumerator and then explicitly closes it via a
+7 −3
Original line number Diff line number Diff line
@@ -91,17 +91,21 @@ ndk::ScopedAStatus LeAudioSoftwareAudioProvider::startSession(
  else if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH)
    buffer_modifier = kBufferInCount;

  // 24 bit audio stream is sent as unpacked
  int bytes_per_sample =
      (pcm_config.bitsPerSample == 24) ? 4 : (pcm_config.bitsPerSample / 8);

  uint32_t data_mq_size =
      (ceil(pcm_config.sampleRateHz) / 1000) *
      channel_mode_to_channel_count(pcm_config.channelMode) *
      (pcm_config.bitsPerSample / 8) * (pcm_config.dataIntervalUs / 1000) *
      buffer_modifier;
      channel_mode_to_channel_count(pcm_config.channelMode) * bytes_per_sample *
      (pcm_config.dataIntervalUs / 1000) * buffer_modifier;
  if (data_mq_size <= 0) {
    LOG(ERROR) << __func__ << "Unexpected audio buffer size: " << data_mq_size
               << ", SampleRateHz: " << pcm_config.sampleRateHz
               << ", ChannelMode: " << toString(pcm_config.channelMode)
               << ", BitsPerSample: "
               << static_cast<int>(pcm_config.bitsPerSample)
               << ", BytesPerSample: " << bytes_per_sample
               << ", DataIntervalUs: " << pcm_config.dataIntervalUs
               << ", SessionType: " << toString(session_type_);
    return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ namespace bluetooth {
namespace audio {

static const PcmCapabilities kDefaultSoftwarePcmCapabilities = {
    .sampleRateHz = {16000, 24000, 44100, 48000, 88200, 96000},
    .sampleRateHz = {16000, 24000, 32000, 44100, 48000, 88200, 96000},
    .channelMode = {ChannelMode::MONO, ChannelMode::STEREO},
    .bitsPerSample = {16, 24, 32},
    .dataIntervalUs = {},
+5 −0
Original line number Diff line number Diff line
@@ -2212,6 +2212,11 @@ TEST_P(GraphicsMapperHidlTest, SetBadMetadata) {
              mGralloc->set(bufferHandle, gralloc4::MetadataType_Dataspace, vec));
    ASSERT_EQ(Error::UNSUPPORTED,
              mGralloc->set(bufferHandle, gralloc4::MetadataType_BlendMode, vec));

    // Keep optional metadata types below and populate the encoded metadata vec
    // with some arbitrary different metadata because the common gralloc4::decode*()
    // functions do not distinguish between an empty vec and bad value.
    ASSERT_EQ(NO_ERROR, gralloc4::encodeDataspace(Dataspace::SRGB_LINEAR, &vec));
    ASSERT_EQ(Error::UNSUPPORTED,
              mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2086, vec));
    ASSERT_EQ(Error::UNSUPPORTED,
+1 −0
Original line number Diff line number Diff line
6e0b1fb58d66a76df8f46a1a6dae5c346ea17d7b
dd9c3f8e21930f9b4c46a4125bd5f5cec90318ec
Loading