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

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

Snap for 4489599 from 30944c7a to pi-release

Change-Id: Ib83df7141ad2a7a2cba932a38acf972c2b3155fc
parents f22c2ab0 30944c7a
Loading
Loading
Loading
Loading
+28 −16
Original line number Diff line number Diff line
@@ -49,10 +49,6 @@
            <xs:selector xpath="modules/module"/>
            <xs:field xpath="@name"/>
        </xs:key>
        <xs:key name="devicePortNameGlobalKey">
            <xs:selector xpath="modules/module/devicePorts/devicePort"/>
            <xs:field xpath="@tagName"/>
        </xs:key>
        <xs:unique name="volumeTargetUniqueness">
            <xs:selector xpath="volumes/volume"/>
            <xs:field xpath="@stream"/>
@@ -73,6 +69,8 @@
    <!-- Enum values of IDevicesFactory::Device
         TODO: generate from hidl to avoid manual sync. -->
    <xs:simpleType name="halName">
        <xs:union>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="primary"/>
                    <xs:enumeration value="a2dp"/>
@@ -82,6 +80,18 @@
                    <xs:enumeration value="stub"/>
                </xs:restriction>
            </xs:simpleType>
            <xs:simpleType>
                <!-- Vendor eXtension names must be in the vx namespace.
                     Vendor are encouraged to namespace their module names.
                     Example for an hypothetical Google virtual reality HAL:
                        <module name="vx_google_vr" halVersion="3.0">
                -->
                <xs:restriction base="xs:string">
                    <xs:pattern value="vx_[_a-zA-Z0-9]+"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:union>
    </xs:simpleType>
    <xs:complexType name="modules">
        <xs:annotation>
            <xs:documentation xml:lang="en">
@@ -127,13 +137,15 @@
                    <xs:selector xpath="mixPorts/mixPort"/>
                    <xs:field xpath="@name"/>
                </xs:unique>
                <!-- Although this key constraint is redundant with devicePortNameGlobalKey,
                     the set is used to constraint defaultOutputDevice and attachedDevice
                     to reference a devicePort of the same module. -->
                <xs:key name="devicePortNameKey">
                    <xs:selector xpath="devicePorts/devicePort"/>
                    <xs:field xpath="@tagName"/>
                </xs:key>
                <xs:unique name="devicePortUniqueness">
                    <xs:selector xpath="devicePorts/devicePort"/>
                    <xs:field xpath="@type"/>
                    <xs:field xpath="@address"/>
                </xs:unique>
                <xs:keyref name="defaultOutputDeviceRef" refer="devicePortNameKey">
                    <xs:selector xpath="defaultOutputDevice"/>
                    <xs:field xpath="."/>
@@ -405,7 +417,7 @@
                    <xs:attribute name="tagName" type="xs:token" use="required"/>
                    <xs:attribute name="type" type="audioDevice" use="required"/>
                    <xs:attribute name="role" type="role" use="required"/>
                    <xs:attribute name="address" type="xs:string" use="optional"/>
                    <xs:attribute name="address" type="xs:string" use="optional" default=""/>
                </xs:complexType>
                <xs:unique name="devicePortProfileUniqueness">
                    <xs:selector xpath="profile"/>
+24 −14
Original line number Diff line number Diff line
@@ -716,11 +716,12 @@ TEST_IO_STREAM(GetBufferSize,
               ASSERT_GE(extract(stream->getBufferSize()),
                         extract(stream->getFrameSize())));

template <class Property, class CapabilityGetter, class Getter, class Setter>
template <class Property, class CapabilityGetter>
static void testCapabilityGetter(const string& name, IStream* stream,
                                 Property currentValue,
                                 CapabilityGetter capablityGetter,
                                 Getter getter, Setter setter) {
                                 Return<Property> (IStream::*getter)(),
                                 Return<Result> (IStream::*setter)(Property),
                                 bool currentMustBeSupported = true) {
    hidl_vec<Property> capabilities;
    ASSERT_OK((stream->*capablityGetter)(returnIn(capabilities)));
    if (capabilities.size() == 0) {
@@ -731,16 +732,24 @@ static void testCapabilityGetter(const string& name, IStream* stream,
        doc::partialTest(name + " is not supported");
        return;
    };
    // TODO: This code has never been tested on a hal that supports
    // getSupportedSampleRates

    if (currentMustBeSupported) {
        Property currentValue = extract((stream->*getter)());
        EXPECT_NE(std::find(capabilities.begin(), capabilities.end(), currentValue),
                  capabilities.end())
            << "current " << name << " is not in the list of the supported ones "
            << toString(capabilities);
    }

    // Check that all declared supported values are indeed supported
    for (auto capability : capabilities) {
        ASSERT_OK((stream->*setter)(capability));
        auto ret = (stream->*setter)(capability);
        ASSERT_TRUE(ret.isOk());
        if (ret == Result::NOT_SUPPORTED) {
            doc::partialTest("Setter is not supported");
            return;
        }
        ASSERT_OK(ret);
        ASSERT_EQ(capability, extract((stream->*getter)()));
    }
}
@@ -748,15 +757,17 @@ static void testCapabilityGetter(const string& name, IStream* stream,
TEST_IO_STREAM(SupportedSampleRate,
               "Check that the stream sample rate is declared as supported",
               testCapabilityGetter("getSupportedSampleRate", stream.get(),
                                    extract(stream->getSampleRate()),
                                    &IStream::getSupportedSampleRates,
                                    &IStream::getSampleRate,
                                    &IStream::setSampleRate))
                                    &IStream::setSampleRate,
                                    // getSupportedSampleRate returns the native sampling rates,
                                    // (the sampling rates that can be played without resampling)
                                    // but other sampling rates can be supported by the HAL.
                                    false))

TEST_IO_STREAM(SupportedChannelMask,
               "Check that the stream channel mask is declared as supported",
               testCapabilityGetter("getSupportedChannelMask", stream.get(),
                                    extract(stream->getChannelMask()),
                                    &IStream::getSupportedChannelMasks,
                                    &IStream::getChannelMask,
                                    &IStream::setChannelMask))
@@ -764,7 +775,6 @@ TEST_IO_STREAM(SupportedChannelMask,
TEST_IO_STREAM(SupportedFormat,
               "Check that the stream format is declared as supported",
               testCapabilityGetter("getSupportedFormat", stream.get(),
                                    extract(stream->getFormat()),
                                    &IStream::getSupportedFormats,
                                    &IStream::getFormat, &IStream::setFormat))

+65 −62
Original line number Diff line number Diff line
@@ -37,7 +37,8 @@ class HidlDeathHandler : public android::hardware::hidl_death_recipient {
    // Death notification for callbacks.
    void serviceDied(
        uint64_t cookie,
      const android::wp<android::hidl::base::V1_0::IBase>& /* who */) override {
        const android::wp<android::hidl::base::V1_0::IBase>& /* who */)
        override {
        cb_function_(cookie);
    }

@@ -61,14 +62,14 @@ class HidlCallbackHandler {
   public:
    HidlCallbackHandler()
        : death_handler_(new HidlDeathHandler<CallbackType>(
            std::bind(&HidlCallbackHandler::onObjectDeath,
                      this,
              std::bind(&HidlCallbackHandler::onObjectDeath, this,
                        std::placeholders::_1))) {}
    ~HidlCallbackHandler() = default;

    bool addCallback(const sp<CallbackType>& cb) {
        // TODO(b/33818800): Can't compare proxies yet. So, use the cookie
    // (callback proxy's raw pointer) to track the death of individual clients.
        // (callback proxy's raw pointer) to track the death of individual
        // clients.
        uint64_t cookie = reinterpret_cast<uint64_t>(cb.get());
        if (cb_set_.find(cb) != cb_set_.end()) {
            LOG(WARNING) << "Duplicate death notification registration";
@@ -82,7 +83,9 @@ class HidlCallbackHandler {
        return true;
    }

  const std::set<android::sp<CallbackType>>& getCallbacks() { return cb_set_; }
    const std::set<android::sp<CallbackType>>& getCallbacks() {
        return cb_set_;
    }

    // Death notification for callbacks.
    void onObjectDeath(uint64_t cookie) {
+47 −60
Original line number Diff line number Diff line
@@ -41,11 +41,8 @@ using namespace android::hardware::wifi::V1_0;
// Use for HIDL methods which return only an instance of WifiStatus.
template <typename ObjT, typename WorkFuncT, typename... Args>
Return<void> validateAndCall(
    ObjT* obj,
    WifiStatusCode status_code_if_invalid,
    WorkFuncT&& work,
    const std::function<void(const WifiStatus&)>& hidl_cb,
    Args&&... args) {
    ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work,
    const std::function<void(const WifiStatus&)>& hidl_cb, Args&&... args) {
    const auto lock = hidl_sync_util::acquireGlobalLock();
    if (obj->isValid()) {
        hidl_cb((obj->*work)(std::forward<Args>(args)...));
@@ -60,11 +57,8 @@ Return<void> validateAndCall(
// Note: Only used by IWifi::stop() currently.
template <typename ObjT, typename WorkFuncT, typename... Args>
Return<void> validateAndCallWithLock(
    ObjT* obj,
    WifiStatusCode status_code_if_invalid,
    WorkFuncT&& work,
    const std::function<void(const WifiStatus&)>& hidl_cb,
    Args&&... args) {
    ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work,
    const std::function<void(const WifiStatus&)>& hidl_cb, Args&&... args) {
    auto lock = hidl_sync_util::acquireGlobalLock();
    if (obj->isValid()) {
        hidl_cb((obj->*work)(&lock, std::forward<Args>(args)...));
@@ -78,9 +72,7 @@ Return<void> validateAndCallWithLock(
// value.
template <typename ObjT, typename WorkFuncT, typename ReturnT, typename... Args>
Return<void> validateAndCall(
    ObjT* obj,
    WifiStatusCode status_code_if_invalid,
    WorkFuncT&& work,
    ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work,
    const std::function<void(const WifiStatus&, ReturnT)>& hidl_cb,
    Args&&... args) {
    const auto lock = hidl_sync_util::acquireGlobalLock();
@@ -98,15 +90,10 @@ Return<void> validateAndCall(

// Use for HIDL methods which return instance of WifiStatus and 2 return
// values.
template <typename ObjT,
          typename WorkFuncT,
          typename ReturnT1,
          typename ReturnT2,
          typename... Args>
template <typename ObjT, typename WorkFuncT, typename ReturnT1,
          typename ReturnT2, typename... Args>
Return<void> validateAndCall(
    ObjT* obj,
    WifiStatusCode status_code_if_invalid,
    WorkFuncT&& work,
    ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work,
    const std::function<void(const WifiStatus&, ReturnT1, ReturnT2)>& hidl_cb,
    Args&&... args) {
    const auto lock = hidl_sync_util::acquireGlobalLock();
@@ -124,7 +111,7 @@ Return<void> validateAndCall(
    return Void();
}

}  // namespace hidl_util
}  // namespace hidl_return_util
}  // namespace implementation
}  // namespace V1_2
}  // namespace wifi
+2031 −1822

File changed.

Preview size limit exceeded, changes collapsed.

Loading