Merge "Update makefiles to remove java-static libs."
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index 3f45afd..de5081d 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -172,15 +172,16 @@
void moveFrom(hidl_string &&);
};
+// Use NOLINT to suppress missing parentheses warnings around OP.
#define HIDL_STRING_OPERATOR(OP) \
inline bool operator OP(const hidl_string &hs1, const hidl_string &hs2) { \
- return strcmp(hs1.c_str(), hs2.c_str()) OP 0; \
+ return strcmp(hs1.c_str(), hs2.c_str()) OP 0; /* NOLINT */ \
} \
inline bool operator OP(const hidl_string &hs, const char *s) { \
- return strcmp(hs.c_str(), s) OP 0; \
+ return strcmp(hs.c_str(), s) OP 0; /* NOLINT */ \
} \
inline bool operator OP(const char *s, const hidl_string &hs) { \
- return strcmp(hs.c_str(), s) OP 0; \
+ return strcmp(hs.c_str(), s) OP 0; /* NOLINT */ \
}
HIDL_STRING_OPERATOR(==)
diff --git a/libhidlmemory/Android.bp b/libhidlmemory/Android.bp
index 79ec4bc..89b39dc 100644
--- a/libhidlmemory/Android.bp
+++ b/libhidlmemory/Android.bp
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-cc_library_shared {
+cc_library {
name: "libhidlmemory",
vendor_available: true,
cflags: libhidl_flags,
diff --git a/test_main.cpp b/test_main.cpp
index 1f2f845..b265607 100644
--- a/test_main.cpp
+++ b/test_main.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "LibHidlTest"
#include <android-base/logging.h>
+#include <condition_variable>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <hidl/HidlSupport.h>
@@ -296,16 +297,23 @@
TEST_F(LibHidlTest, TaskRunnerTest) {
using android::hardware::details::TaskRunner;
+ using namespace std::chrono_literals;
+
+ std::condition_variable cv;
+ std::mutex m;
+
TaskRunner tr;
tr.start(1 /* limit */);
bool flag = false;
tr.push([&] {
- usleep(1000);
flag = true;
+ cv.notify_all();
});
- usleep(500);
- EXPECT_FALSE(flag);
- usleep(1000);
+
+ std::unique_lock<std::mutex> lock(m);
+
+ // 1s so this doesn't deadlock. This isn't a performance test.
+ EXPECT_TRUE(cv.wait_for(lock, 1s, [&]{return flag;}));
EXPECT_TRUE(flag);
}