Snap for 8730993 from be0590e8a1711d85c6c51cdbcbcfd45133c3f0f8 to mainline-tzdata3-release

Change-Id: I48dbdca828db4102e987770446a3d4a22e7a8fa1
diff --git a/Android.bp b/Android.bp
index f37f1c6..5889a9c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -30,10 +30,7 @@
     ],
     apex_available: [
         "//apex_available:platform",
-        "com.android.bluetooth",
-        "com.android.media.swcodec",
         "com.android.neuralnetworks",
-        "test_com.android.media.swcodec",
         "test_com.android.neuralnetworks",
     ],
     export_include_dirs: ["include"],
diff --git a/EventFlag.cpp b/EventFlag.cpp
index d353873..96f9519 100644
--- a/EventFlag.cpp
+++ b/EventFlag.cpp
@@ -32,6 +32,26 @@
 namespace android {
 namespace hardware {
 
+status_t EventFlag::createEventFlag(int fd, off_t offset, EventFlag** flag) {
+    if (flag == nullptr) {
+        return BAD_VALUE;
+    }
+
+    status_t status = NO_MEMORY;
+    *flag = nullptr;
+
+    EventFlag* evFlag = new (std::nothrow) EventFlag(fd, offset, &status);
+    if (evFlag != nullptr) {
+        if (status == NO_ERROR) {
+            *flag = evFlag;
+        } else {
+            delete evFlag;
+        }
+    }
+
+    return status;
+}
+
 status_t EventFlag::createEventFlag(std::atomic<uint32_t>* fwAddr,
                                     EventFlag** flag) {
     if (flag == nullptr) {
@@ -54,6 +74,23 @@
 }
 
 /*
+ * mmap memory for the futex word
+ */
+EventFlag::EventFlag(int fd, off_t offset, status_t* status) {
+    mEfWordPtr = static_cast<std::atomic<uint32_t>*>(mmap(NULL,
+                                                          sizeof(std::atomic<uint32_t>),
+                                                          PROT_READ | PROT_WRITE,
+                                                          MAP_SHARED, fd, offset));
+    mEfWordNeedsUnmapping = true;
+    if (mEfWordPtr != MAP_FAILED) {
+        *status = NO_ERROR;
+    } else {
+        *status = -errno;
+        ALOGE("Attempt to mmap event flag word failed: %s\n", strerror(errno));
+    }
+}
+
+/*
  * Use this constructor if we already know where the futex word for
  * the EventFlag group lives.
  */
diff --git a/FmqInternal.cpp b/FmqInternal.cpp
index 6aad3aa..886d155 100644
--- a/FmqInternal.cpp
+++ b/FmqInternal.cpp
@@ -26,10 +26,6 @@
     CHECK(exp);
 }
 
-void check(bool exp, const char* message) {
-    CHECK(exp) << message;
-}
-
 void logError(const std::string &message) {
     LOG(ERROR) << message;
 }
diff --git a/OWNERS b/OWNERS
index cc4d814..d19e4ea 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,4 +1,4 @@
 smoreland@google.com
 elsk@google.com
 malchev@google.com
-devinmoore@google.com
+hridya@google.com
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 9f1aa6b..dfa7071 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -6,13 +6,5 @@
     {
       "name": "fmq_test"
     }
-  ],
-  "hwasan-postsubmit": [
-    {
-      "name": "fmq_unit_tests"
-    },
-    {
-      "name": "fmq_test"
-    }
   ]
 }
diff --git a/base/fmq/MQDescriptorBase.h b/base/fmq/MQDescriptorBase.h
index 7303917..0d18d4c 100644
--- a/base/fmq/MQDescriptorBase.h
+++ b/base/fmq/MQDescriptorBase.h
@@ -55,7 +55,6 @@
 
 void logError(const std::string& message);
 void errorWriteLog(int tag, const char* message);
-void check(bool exp, const char* message);
 
 typedef uint64_t RingBufferPosition;
 enum GrantorType : int { READPTRPOS = 0, WRITEPTRPOS, DATAPTRPOS, EVFLAGWORDPOS };
@@ -74,12 +73,20 @@
 
 static inline size_t alignToWordBoundary(size_t length) {
     constexpr size_t kAlignmentSize = 64;
-    static_assert(kAlignmentSize % sizeof(long) == 0, "Incompatible word size");
+    if (kAlignmentSize % __WORDSIZE != 0) {
+#ifdef __BIONIC__
+        __assert(__FILE__, __LINE__, "Incompatible word size");
+#endif
+    }
 
     /*
      * Check if alignment to word boundary would cause an overflow.
      */
-    check(length <= SIZE_MAX - kAlignmentSize / 8 + 1, "Queue size too large");
+    if (length > SIZE_MAX - kAlignmentSize / 8 + 1) {
+#ifdef __BIONIC__
+        __assert(__FILE__, __LINE__, "Queue size too large");
+#endif
+    }
 
     return (length + kAlignmentSize / 8 - 1) & ~(kAlignmentSize / 8 - 1U);
 }
diff --git a/fuzzer/Android.bp b/fuzzer/Android.bp
index 0926c09..6b41e3f 100644
--- a/fuzzer/Android.bp
+++ b/fuzzer/Android.bp
@@ -19,19 +19,17 @@
 cc_fuzz {
     name: "fmq_fuzzer",
 
+    defaults: [
+        "libbinder_ndk_host_user",
+    ],
+
     srcs: [
         "fmq_fuzzer.cpp",
     ],
 
-    target: {
-        darwin: {
-            enabled: false,
-        },
-    },
-
     static_libs: [
         "libfmq",
-        "android.hardware.common.fmq-V1-ndk",
+        "android.hardware.common.fmq-V1-ndk_platform",
     ],
 
     shared_libs: [
@@ -56,9 +54,9 @@
     host_supported: true,
 
     sanitize: {
+        hwaddress: true,
         scs: true,
         cfi: true,
-        address: true,
         memtag_heap: true,
         // undefined behavior is expected
         all_undefined: false,
diff --git a/fuzzer/fmq_fuzzer.cpp b/fuzzer/fmq_fuzzer.cpp
index 8c8a78e..844188f 100644
--- a/fuzzer/fmq_fuzzer.cpp
+++ b/fuzzer/fmq_fuzzer.cpp
@@ -21,7 +21,6 @@
 #include <thread>
 
 #include <android-base/logging.h>
-#include <android-base/scopeguard.h>
 #include <fmq/AidlMessageQueue.h>
 #include <fmq/ConvertMQDescriptors.h>
 #include <fmq/EventFlag.h>
@@ -36,9 +35,6 @@
 
 typedef int32_t payload_t;
 
-// The reader will wait for 10 ms
-static constexpr int kBlockingTimeoutNs = 10000000;
-
 /*
  * MessageQueueBase.h contains asserts when memory allocation fails. So we need
  * to set a reasonable limit if we want to avoid those asserts.
@@ -59,7 +55,6 @@
 
 static constexpr int kMaxNumSyncReaders = 1;
 static constexpr int kMaxNumUnsyncReaders = 5;
-static constexpr int kMaxDataPerReader = 1000;
 
 typedef android::AidlMessageQueue<payload_t, SynchronizedReadWrite> AidlMessageQueueSync;
 typedef android::AidlMessageQueue<payload_t, UnsynchronizedWrite> AidlMessageQueueUnsync;
@@ -72,19 +67,14 @@
 typedef android::hardware::MQDescriptorSync<payload_t> MQDescSync;
 typedef android::hardware::MQDescriptorUnsync<payload_t> MQDescUnsync;
 
-static inline uint64_t* getCounterPtr(payload_t* start, int byteOffset) {
-    return reinterpret_cast<uint64_t*>(reinterpret_cast<uint8_t*>(start) - byteOffset);
-}
-
 template <typename Queue, typename Desc>
-void reader(const Desc& desc, std::vector<uint8_t> readerData, bool userFd) {
+void reader(const Desc& desc, std::vector<uint8_t> readerData) {
     Queue readMq(desc);
     if (!readMq.isValid()) {
         LOG(ERROR) << "read mq invalid";
         return;
     }
     FuzzedDataProvider fdp(&readerData[0], readerData.size());
-    payload_t* ring = nullptr;
     while (fdp.remaining_bytes()) {
         typename Queue::MemTransaction tx;
         size_t numElements = fdp.ConsumeIntegralInRange<size_t>(0, kMaxNumElements);
@@ -94,57 +84,19 @@
         const auto& region = tx.getFirstRegion();
         payload_t* firstStart = region.getAddress();
 
-        // the ring buffer is only next to the read/write counters when there is
-        // no user supplied fd
-        if (!userFd) {
-            if (ring == nullptr) {
-                ring = firstStart;
-            }
-            if (fdp.ConsumeIntegral<uint8_t>() == 1) {
-                uint64_t* writeCounter = getCounterPtr(ring, kWriteCounterOffsetBytes);
-                *writeCounter = fdp.ConsumeIntegral<uint64_t>();
-            }
-        }
+        // TODO add the debug function to get pointer to the ring buffer
+        uint64_t* writeCounter = reinterpret_cast<uint64_t*>(
+                reinterpret_cast<uint8_t*>(firstStart) - kWriteCounterOffsetBytes);
+        *writeCounter = fdp.ConsumeIntegral<uint64_t>();
+
         (void)std::to_string(*firstStart);
 
         readMq.commitRead(numElements);
     }
 }
 
-template <typename Queue, typename Desc>
-void readerBlocking(const Desc& desc, std::vector<uint8_t>& readerData,
-                    std::atomic<size_t>& readersNotFinished,
-                    std::atomic<size_t>& writersNotFinished) {
-    android::base::ScopeGuard guard([&readersNotFinished]() { readersNotFinished--; });
-    Queue readMq(desc);
-    if (!readMq.isValid()) {
-        LOG(ERROR) << "read mq invalid";
-        return;
-    }
-    FuzzedDataProvider fdp(&readerData[0], readerData.size());
-    do {
-        size_t count = fdp.remaining_bytes()
-                               ? fdp.ConsumeIntegralInRange<size_t>(1, readMq.getQuantumCount())
-                               : 1;
-        std::vector<payload_t> data;
-        data.resize(count);
-        readMq.readBlocking(data.data(), count, kBlockingTimeoutNs);
-    } while (fdp.remaining_bytes() > sizeof(size_t) && writersNotFinished > 0);
-}
-
-// Can't use blocking calls with Unsync queues(there is a static_assert)
-template <>
-void readerBlocking<AidlMessageQueueUnsync, AidlMQDescUnsync>(const AidlMQDescUnsync&,
-                                                              std::vector<uint8_t>&,
-                                                              std::atomic<size_t>&,
-                                                              std::atomic<size_t>&) {}
-template <>
-void readerBlocking<MessageQueueUnsync, MQDescUnsync>(const MQDescUnsync&, std::vector<uint8_t>&,
-                                                      std::atomic<size_t>&, std::atomic<size_t>&) {}
-
 template <typename Queue>
-void writer(Queue& writeMq, FuzzedDataProvider& fdp, bool userFd) {
-    payload_t* ring = nullptr;
+void writer(Queue& writeMq, FuzzedDataProvider& fdp) {
     while (fdp.remaining_bytes()) {
         typename Queue::MemTransaction tx;
         size_t numElements = 1;
@@ -156,61 +108,23 @@
 
         const auto& region = tx.getFirstRegion();
         payload_t* firstStart = region.getAddress();
-        // the ring buffer is only next to the read/write counters when there is
-        // no user supplied fd
-        if (!userFd) {
-            if (ring == nullptr) {
-                ring = firstStart;
-            }
-            if (fdp.ConsumeIntegral<uint8_t>() == 1) {
-                uint64_t* readCounter = getCounterPtr(ring, kReadCounterOffsetBytes);
-                *readCounter = fdp.ConsumeIntegral<uint64_t>();
-            }
-        }
+
+        // TODO add the debug function to get pointer to the ring buffer
+        uint64_t* readCounter = reinterpret_cast<uint64_t*>(reinterpret_cast<uint8_t*>(firstStart) -
+                                                            kReadCounterOffsetBytes);
+        *readCounter = fdp.ConsumeIntegral<uint64_t>();
+
         *firstStart = fdp.ConsumeIntegral<payload_t>();
 
         writeMq.commitWrite(numElements);
     }
 }
 
-template <typename Queue>
-void writerBlocking(Queue& writeMq, FuzzedDataProvider& fdp,
-                    std::atomic<size_t>& writersNotFinished,
-                    std::atomic<size_t>& readersNotFinished) {
-    android::base::ScopeGuard guard([&writersNotFinished]() { writersNotFinished--; });
-    while (fdp.remaining_bytes() > sizeof(size_t) && readersNotFinished > 0) {
-        size_t count = fdp.ConsumeIntegralInRange<size_t>(1, writeMq.getQuantumCount());
-        std::vector<payload_t> data;
-        for (int i = 0; i < count; i++) {
-            data.push_back(fdp.ConsumeIntegral<payload_t>());
-        }
-        writeMq.writeBlocking(data.data(), count, kBlockingTimeoutNs);
-    }
-}
-
-// Can't use blocking calls with Unsync queues(there is a static_assert)
-template <>
-void writerBlocking<AidlMessageQueueUnsync>(AidlMessageQueueUnsync&, FuzzedDataProvider&,
-                                            std::atomic<size_t>&, std::atomic<size_t>&) {}
-template <>
-void writerBlocking<MessageQueueUnsync>(MessageQueueUnsync&, FuzzedDataProvider&,
-                                        std::atomic<size_t>&, std::atomic<size_t>&) {}
-
 template <typename Queue, typename Desc>
 void fuzzAidlWithReaders(std::vector<uint8_t>& writerData,
-                         std::vector<std::vector<uint8_t>>& readerData, bool blocking) {
+                         std::vector<std::vector<uint8_t>>& readerData) {
     FuzzedDataProvider fdp(&writerData[0], writerData.size());
-    bool evFlag = blocking || fdp.ConsumeBool();
-    android::base::unique_fd dataFd;
-    size_t bufferSize = 0;
-    size_t numElements = fdp.ConsumeIntegralInRange<size_t>(1, kMaxNumElements);
-    bool userFd = fdp.ConsumeBool();
-    if (userFd) {
-        // run test with our own data region
-        bufferSize = numElements * sizeof(payload_t);
-        dataFd.reset(::ashmem_create_region("SyncReadWrite", bufferSize));
-    }
-    Queue writeMq(numElements, evFlag, std::move(dataFd), bufferSize);
+    Queue writeMq(fdp.ConsumeIntegralInRange<size_t>(1, kMaxNumElements), fdp.ConsumeBool());
     if (!writeMq.isValid()) {
         LOG(ERROR) << "AIDL write mq invalid";
         return;
@@ -218,47 +132,23 @@
     const auto desc = writeMq.dupeDesc();
     CHECK(desc.handle.fds[0].get() != -1);
 
-    std::atomic<size_t> readersNotFinished = readerData.size();
-    std::atomic<size_t> writersNotFinished = 1;
-    std::vector<std::thread> readers;
+    std::vector<std::thread> clients;
     for (int i = 0; i < readerData.size(); i++) {
-        if (blocking) {
-            readers.emplace_back(readerBlocking<Queue, Desc>, std::ref(desc),
-                                 std::ref(readerData[i]), std::ref(readersNotFinished),
-                                 std::ref(writersNotFinished));
-
-        } else {
-            readers.emplace_back(reader<Queue, Desc>, std::ref(desc), std::ref(readerData[i]),
-                                 userFd);
-        }
+        clients.emplace_back(reader<Queue, Desc>, std::ref(desc), std::ref(readerData[i]));
     }
 
-    if (blocking) {
-        writerBlocking<Queue>(writeMq, fdp, writersNotFinished, readersNotFinished);
-    } else {
-        writer<Queue>(writeMq, fdp, userFd);
-    }
+    writer<Queue>(writeMq, fdp);
 
-    for (auto& reader : readers) {
-        reader.join();
+    for (auto& client : clients) {
+        client.join();
     }
 }
 
 template <typename Queue, typename Desc>
 void fuzzHidlWithReaders(std::vector<uint8_t>& writerData,
-                         std::vector<std::vector<uint8_t>>& readerData, bool blocking) {
+                         std::vector<std::vector<uint8_t>>& readerData) {
     FuzzedDataProvider fdp(&writerData[0], writerData.size());
-    bool evFlag = blocking || fdp.ConsumeBool();
-    android::base::unique_fd dataFd;
-    size_t bufferSize = 0;
-    size_t numElements = fdp.ConsumeIntegralInRange<size_t>(1, kMaxNumElements);
-    bool userFd = fdp.ConsumeBool();
-    if (userFd) {
-        // run test with our own data region
-        bufferSize = numElements * sizeof(payload_t);
-        dataFd.reset(::ashmem_create_region("SyncReadWrite", bufferSize));
-    }
-    Queue writeMq(numElements, evFlag, std::move(dataFd), bufferSize);
+    Queue writeMq(fdp.ConsumeIntegralInRange<size_t>(1, kMaxNumElements), fdp.ConsumeBool());
     if (!writeMq.isValid()) {
         LOG(ERROR) << "HIDL write mq invalid";
         return;
@@ -266,28 +156,15 @@
     const auto desc = writeMq.getDesc();
     CHECK(desc->isHandleValid());
 
-    std::atomic<size_t> readersNotFinished = readerData.size();
-    std::atomic<size_t> writersNotFinished = 1;
-    std::vector<std::thread> readers;
+    std::vector<std::thread> clients;
     for (int i = 0; i < readerData.size(); i++) {
-        if (blocking) {
-            readers.emplace_back(readerBlocking<Queue, Desc>, std::ref(*desc),
-                                 std::ref(readerData[i]), std::ref(readersNotFinished),
-                                 std::ref(writersNotFinished));
-        } else {
-            readers.emplace_back(reader<Queue, Desc>, std::ref(*desc), std::ref(readerData[i]),
-                                 userFd);
-        }
+        clients.emplace_back(reader<Queue, Desc>, std::ref(*desc), std::ref(readerData[i]));
     }
 
-    if (blocking) {
-        writerBlocking<Queue>(writeMq, fdp, writersNotFinished, readersNotFinished);
-    } else {
-        writer<Queue>(writeMq, fdp, userFd);
-    }
+    writer<Queue>(writeMq, fdp);
 
-    for (auto& reader : readers) {
-        reader.join();
+    for (auto& client : clients) {
+        client.join();
     }
 }
 
@@ -302,18 +179,16 @@
     uint8_t numReaders = fuzzSync ? fdp.ConsumeIntegralInRange<uint8_t>(0, kMaxNumSyncReaders)
                                   : fdp.ConsumeIntegralInRange<uint8_t>(0, kMaxNumUnsyncReaders);
     for (int i = 0; i < numReaders; i++) {
-        readerData.emplace_back(fdp.ConsumeBytes<uint8_t>(kMaxDataPerReader));
+        readerData.emplace_back(fdp.ConsumeBytes<uint8_t>(5));
     }
-    bool fuzzBlocking = fdp.ConsumeBool();
     std::vector<uint8_t> writerData = fdp.ConsumeRemainingBytes<uint8_t>();
+
     if (fuzzSync) {
-        fuzzHidlWithReaders<MessageQueueSync, MQDescSync>(writerData, readerData, fuzzBlocking);
-        fuzzAidlWithReaders<AidlMessageQueueSync, AidlMQDescSync>(writerData, readerData,
-                                                                  fuzzBlocking);
+        fuzzHidlWithReaders<MessageQueueSync, MQDescSync>(writerData, readerData);
+        fuzzAidlWithReaders<AidlMessageQueueSync, AidlMQDescSync>(writerData, readerData);
     } else {
-        fuzzHidlWithReaders<MessageQueueUnsync, MQDescUnsync>(writerData, readerData, false);
-        fuzzAidlWithReaders<AidlMessageQueueUnsync, AidlMQDescUnsync>(writerData, readerData,
-                                                                      false);
+        fuzzHidlWithReaders<MessageQueueUnsync, MQDescUnsync>(writerData, readerData);
+        fuzzAidlWithReaders<AidlMessageQueueUnsync, AidlMQDescUnsync>(writerData, readerData);
     }
 
     return 0;
diff --git a/include/fmq/EventFlag.h b/include/fmq/EventFlag.h
index 3ec4932..af18448 100644
--- a/include/fmq/EventFlag.h
+++ b/include/fmq/EventFlag.h
@@ -31,6 +31,22 @@
  */
 struct EventFlag {
     /**
+     * Create an event flag object with mapping information.
+     *
+     * @param fd File descriptor to be mmapped to create the event flag word.
+     * There is no transfer of ownership of the fd. The caller will still
+     * own the fd for the purpose of closing it.
+     * @param offset Offset parameter to mmap.
+     * @param ef Pointer to address of the EventFlag object that gets created. Will be set to
+     * nullptr if unsuccesful.
+     *
+     * @return status Returns a status_t error code. Likely error codes are
+     * NO_ERROR if the method is successful or BAD_VALUE due to invalid
+     * mapping arguments.
+     */
+    static status_t createEventFlag(int fd, off_t offset, EventFlag** ef);
+
+    /**
      * Create an event flag object from the address of the flag word.
      *
      * @param  efWordPtr Pointer to the event flag word.
@@ -95,6 +111,11 @@
     std::atomic<uint32_t>* mEfWordPtr = nullptr;
 
     /*
+     * mmap memory for the event flag word.
+     */
+    EventFlag(int fd, off_t offset, status_t* status);
+
+    /*
      * Use this constructor if we already know where the event flag word
      * lives.
      */
diff --git a/include/fmq/MessageQueueBase.h b/include/fmq/MessageQueueBase.h
index c34a4ff..b932317 100644
--- a/include/fmq/MessageQueueBase.h
+++ b/include/fmq/MessageQueueBase.h
@@ -588,8 +588,11 @@
 
     const auto& grantors = mDesc->grantors();
     for (const auto& grantor : grantors) {
-        hardware::details::check(hardware::details::isAlignedToWordBoundary(grantor.offset) == true,
-                                 "Grantor offsets need to be aligned");
+        if (hardware::details::isAlignedToWordBoundary(grantor.offset) == false) {
+#ifdef __BIONIC__
+            __assert(__FILE__, __LINE__, "Grantor offsets need to be aligned");
+#endif
+        }
     }
 
     if (flavor == kSynchronizedReadWrite) {
@@ -602,11 +605,19 @@
          */
         mReadPtr = new (std::nothrow) std::atomic<uint64_t>;
     }
-    hardware::details::check(mReadPtr != nullptr, "mReadPtr is null");
+    if (mReadPtr == nullptr) {
+#ifdef __BIONIC__
+        __assert(__FILE__, __LINE__, "mReadPtr is null");
+#endif
+    }
 
     mWritePtr = reinterpret_cast<std::atomic<uint64_t>*>(
             mapGrantorDescr(hardware::details::WRITEPTRPOS));
-    hardware::details::check(mWritePtr != nullptr, "mWritePtr is null");
+    if (mWritePtr == nullptr) {
+#ifdef __BIONIC__
+        __assert(__FILE__, __LINE__, "mWritePtr is null");
+#endif
+    }
 
     if (resetPointers) {
         mReadPtr->store(0, std::memory_order_release);
@@ -617,13 +628,22 @@
     }
 
     mRing = reinterpret_cast<uint8_t*>(mapGrantorDescr(hardware::details::DATAPTRPOS));
-    hardware::details::check(mRing != nullptr, "mRing is null");
+    if (mRing == nullptr) {
+#ifdef __BIONIC__
+        __assert(__FILE__, __LINE__, "mRing is null");
+#endif
+    }
 
     if (mDesc->countGrantors() > hardware::details::EVFLAGWORDPOS) {
         mEvFlagWord = static_cast<std::atomic<uint32_t>*>(
                 mapGrantorDescr(hardware::details::EVFLAGWORDPOS));
-        hardware::details::check(mEvFlagWord != nullptr, "mEvFlagWord is null");
-        android::hardware::EventFlag::createEventFlag(mEvFlagWord, &mEventFlag);
+        if (mEvFlagWord != nullptr) {
+            android::hardware::EventFlag::createEventFlag(mEvFlagWord, &mEventFlag);
+        } else {
+#ifdef __BIONIC__
+            __assert(__FILE__, __LINE__, "mEvFlagWord is null");
+#endif
+        }
     }
 }
 
diff --git a/tests/Android.bp b/tests/Android.bp
index 40148b1..ec38cea 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -35,7 +35,6 @@
 
 cc_test {
     name: "fmq_test_client",
-    tidy_timeout_srcs: ["msgq_test_client.cpp"],
     srcs: ["msgq_test_client.cpp"],
 
     cflags: [
@@ -59,10 +58,10 @@
     // These are static libs only for testing purposes and portability. Shared
     // libs should be used on device.
     static_libs: [
-        "android.hardware.common-V2-ndk",
-        "android.hardware.common.fmq-V1-ndk",
+        "android.hardware.common-V2-ndk_platform",
+        "android.hardware.common.fmq-V1-ndk_platform",
         "android.hardware.tests.msgq@1.0",
-        "android.fmq.test-ndk",
+        "android.fmq.test-ndk_platform",
     ],
     whole_static_libs: [
         "android.hardware.tests.msgq@1.0-impl",
@@ -85,7 +84,6 @@
 cc_test {
     name: "fmq_unit_tests",
 
-    tidy_timeout_srcs: ["fmq_unit_tests.cpp"],
     srcs: ["fmq_unit_tests.cpp"],
     shared_libs: [
         "libbase",
@@ -96,7 +94,7 @@
         "libutils",
     ],
     static_libs: [
-        "android.hardware.common.fmq-V1-ndk",
+        "android.hardware.common.fmq-V1-ndk_platform",
     ],
 
     cflags: [
diff --git a/tests/aidl/android/fmq/test/FixedParcelable.aidl b/tests/aidl/android/fmq/test/FixedParcelable.aidl
index 7d0c0e5..acb54f2 100644
--- a/tests/aidl/android/fmq/test/FixedParcelable.aidl
+++ b/tests/aidl/android/fmq/test/FixedParcelable.aidl
@@ -17,11 +17,9 @@
 package android.fmq.test;
 
 import android.fmq.test.EventFlagBits;
-import android.fmq.test.FixedUnion;
 
 @FixedSize
 parcelable FixedParcelable {
   int a;
   EventFlagBits b;
-  FixedUnion u;
 }
diff --git a/tests/aidl/android/fmq/test/FixedUnion.aidl b/tests/aidl/android/fmq/test/FixedUnion.aidl
deleted file mode 100644
index 40a4a28..0000000
--- a/tests/aidl/android/fmq/test/FixedUnion.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.fmq.test;
-
-import android.fmq.test.EventFlagBits;
-
-@FixedSize
-union FixedUnion {
-  int a;
-  EventFlagBits b;
-}
diff --git a/tests/aidl/default/Android.bp b/tests/aidl/default/Android.bp
index 35bd043..71a5533 100644
--- a/tests/aidl/default/Android.bp
+++ b/tests/aidl/default/Android.bp
@@ -10,7 +10,7 @@
         "libfmq",
     ],
     static_libs: [
-        "android.fmq.test-ndk",
+        "android.fmq.test-ndk_platform",
     ],
     export_include_dirs: ["."],
     srcs: [
diff --git a/tests/fmq_unit_tests.cpp b/tests/fmq_unit_tests.cpp
index d3fdfbc..be866ec 100644
--- a/tests/fmq_unit_tests.cpp
+++ b/tests/fmq_unit_tests.cpp
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <android-base/logging.h>
 #include <asm-generic/mman.h>
 #include <fmq/AidlMessageQueue.h>
 #include <fmq/ConvertMQDescriptors.h>
@@ -515,9 +514,8 @@
  * "mRing is null".
  */
 TEST_F(DoubleFdFailures, InvalidFd) {
-    android::base::SetLogger(android::base::StdioLogger);
     EXPECT_DEATH_IF_SUPPORTED(AidlMessageQueueSync(64, false, android::base::unique_fd(3000), 64),
-                              "Check failed: exp mRing is null");
+                              "mRing is null");
 }
 
 /*
diff --git a/tests/msgq_test_client.cpp b/tests/msgq_test_client.cpp
index 1ff9d50..a6f1ccc 100644
--- a/tests/msgq_test_client.cpp
+++ b/tests/msgq_test_client.cpp
@@ -20,7 +20,6 @@
 #endif
 
 #include <aidl/android/fmq/test/FixedParcelable.h>
-#include <aidl/android/fmq/test/FixedUnion.h>
 #include <aidl/android/fmq/test/ITestAidlMsgQ.h>
 #include <android-base/logging.h>
 #include <android/binder_manager.h>
@@ -39,7 +38,6 @@
 // generated
 using ::aidl::android::fmq::test::EventFlagBits;
 using ::aidl::android::fmq::test::FixedParcelable;
-using ::aidl::android::fmq::test::FixedUnion;
 using ::aidl::android::fmq::test::ITestAidlMsgQ;
 using android::hardware::tests::msgq::V1_0::ITestMsgQ;
 
@@ -1171,8 +1169,8 @@
  * annotated with @FixedSize is supported. A parcelable without it, will cause
  * a compilation error.
  */
-typedef ::testing::Types<FixedParcelable, FixedUnion, EventFlagBits, bool, int8_t, char, char16_t,
-                         int32_t, int64_t, float, double>
+typedef ::testing::Types<FixedParcelable, EventFlagBits, bool, int8_t, char, char16_t, int32_t,
+                         int64_t, float, double>
         AidlTypeCheckTypes;
 
 template <typename T>