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

Commit c5193fce authored by Bill Yi's avatar Bill Yi
Browse files

Merge pi-qpr1-release PQ1A.181105.017.A1 to pi-platform-release

Change-Id: I0777ff28aa01814239b3d53fd4c34f7742459788
parents ef97157f d12eece0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2,7 +2,8 @@ service vendor.audio-hal-2-0 /vendor/bin/hw/android.hardware.audio@2.0-service
    class hal
    user audioserver
    # media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
    group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct
    group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock
    capabilities BLOCK_SUSPEND
    ioprio rt 4
    writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks
    # audioflinger restarts itself when it loses connection with the hal
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ namespace utility {
class Environment : public ::testing::VtsHalHidlTargetTestEnvBase {
   public:
    using TearDownFunc = std::function<void()>;
    void registerTearDown(TearDownFunc&& tearDown) { tearDowns.push_back(std::move(tearDown)); }
    void registerTearDown(TearDownFunc&& tearDown) { tearDowns.push_front(std::move(tearDown)); }

   private:
    void HidlTearDown() override {
+24 −16
Original line number Diff line number Diff line
@@ -45,29 +45,37 @@ namespace utility {
                        xmlFilePath, xsdFilePath)

/** Validate an XML according to an xsd.
 * The XML file must be in at least one of the provided locations.
 * If multiple are found, all are validated.
 * All file named xmlFileName in each xmlFileLocations folder must be valid if present.
 * @tparam atLeastOneRequired If true, at least one file has to be found.
 *                           If false, no found file is a success.
 */
template <bool atLeastOneRequired = true>
::testing::AssertionResult validateXmlMultipleLocations(
    const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr,
    const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath);

/** ASSERT that an XML is valid according to an xsd.
 * The XML file must be in at least one of the provided locations.
 * If multiple are found, all are validated.
 */
/** ASSERT that all found XML are valid according to an xsd. */
#define ASSERT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath)         \
    ASSERT_PRED_FORMAT3(                                                                        \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \
        xmlFileName, xmlFileLocations, xsdFilePath)

/** EXPECT that all found XML are valid according to an xsd. */
#define EXPECT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath)         \
    EXPECT_PRED_FORMAT3(                                                                        \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \
        xmlFileName, xmlFileLocations, xsdFilePath)

/** ASSERT that all found XML are valid according to an xsd. At least one must be found. */
#define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath)    \
    ASSERT_PRED_FORMAT3(                                                                       \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations,    \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \
        xmlFileName, xmlFileLocations, xsdFilePath)

/** EXPECT an XML to be valid according to an xsd.
 * The XML file must be in at least one of the provided locations.
 * If multiple are found, all are validated.
 */
/** EXPECT that all found XML are valid according to an xsd. At least one must be found. */
#define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath)    \
    EXPECT_PRED_FORMAT3(                                                                       \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations,    \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \
        xmlFileName, xmlFileLocations, xsdFilePath)

}  // namespace utility
+14 −2
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ struct Libxml2Global {
    return ::testing::AssertionSuccess();
}

template <bool atLeastOneRequired>
::testing::AssertionResult validateXmlMultipleLocations(
    const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr,
    const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath) {
@@ -150,7 +151,7 @@ struct Libxml2Global {
        }
    }

    if (foundFiles.empty()) {
    if (atLeastOneRequired && foundFiles.empty()) {
        errors.push_back("No xml file found in provided locations.\n");
    }

@@ -160,8 +161,19 @@ struct Libxml2Global {
           << "     While validating all: " << xmlFileNameExpr
           << "\n                 Which is: " << xmlFileName
           << "\n In the following folders: " << xmlFileLocationsExpr
           << "\n                 Which is: " << ::testing::PrintToString(xmlFileLocations);
}
           << "\n                 Which is: " << ::testing::PrintToString(xmlFileLocations)
           << (atLeastOneRequired ? "Where at least one file must be found."
                                  : "Where no file might exist.");
}

template ::testing::AssertionResult validateXmlMultipleLocations<true>(const char*, const char*,
                                                                       const char*, const char*,
                                                                       std::vector<const char*>,
                                                                       const char*);
template ::testing::AssertionResult validateXmlMultipleLocations<false>(const char*, const char*,
                                                                        const char*, const char*,
                                                                        std::vector<const char*>,
                                                                        const char*);

}  // namespace utility
}  // namespace test
+11 −6
Original line number Diff line number Diff line
@@ -106,7 +106,10 @@ using namespace ::android::hardware::audio::common::test::utility;
static auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED};
static auto okOrNotSupportedOrInvalidArgs = {Result::OK, Result::NOT_SUPPORTED,
                                             Result::INVALID_ARGUMENTS};
static auto okOrInvalidStateOrNotSupported = {Result::OK, Result::INVALID_STATE,
                                              Result::NOT_SUPPORTED};
static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED};
static auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED};

class AudioHidlTestEnvironment : public ::Environment {
   public:
@@ -555,11 +558,11 @@ TEST_F(AudioPrimaryHidlTest, SetConnectedState) {
            address.device = deviceType;
            auto ret = device->setConnectedState(address, state);
            ASSERT_TRUE(ret.isOk());
            if (res == Result::NOT_SUPPORTED) {
            if (ret == Result::NOT_SUPPORTED) {
                doc::partialTest("setConnectedState is not supported");
                return;
            }
            ASSERT_OK(res);
            ASSERT_OK(ret);
        }
    }
}
@@ -949,8 +952,6 @@ TEST_IO_STREAM(RemoveNonExistingEffect, "Removing a non existing effect should f
TEST_IO_STREAM(standby, "Make sure the stream can be put in stanby",
               ASSERT_OK(stream->standby()))  // can not fail

static constexpr auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED};

TEST_IO_STREAM(startNoMmap, "Starting a mmaped stream before mapping it should fail",
               ASSERT_RESULT(invalidStateOrNotSupported, stream->start()))

@@ -1070,11 +1071,15 @@ TEST_P(InputStreamTest, GetInputFramesLost) {
TEST_P(InputStreamTest, getCapturePosition) {
    doc::test(
        "The capture position of a non prepared stream should not be "
        "retrievable");
        "retrievable or 0");
    uint64_t frames;
    uint64_t time;
    ASSERT_OK(stream->getCapturePosition(returnIn(res, frames, time)));
    ASSERT_RESULT(invalidStateOrNotSupported, res);
    ASSERT_RESULT(okOrInvalidStateOrNotSupported, res);
    if (res == Result::OK) {
        ASSERT_EQ(0U, frames);
        ASSERT_LE(0U, time);
    }
}

TEST_P(InputStreamTest, updateSinkMetadata) {
Loading