Merge "init: shutdown,thermal shut off display immediately"
diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp
index 41a5868..31c8803 100644
--- a/fs_mgr/fs_mgr_fstab.cpp
+++ b/fs_mgr/fs_mgr_fstab.cpp
@@ -782,11 +782,12 @@
* Returns the 1st matching fstab_rec that follows the start_rec.
* start_rec is the result of a previous search or NULL.
*/
-struct fstab_rec *fs_mgr_get_entry_for_mount_point_after(struct fstab_rec *start_rec, struct fstab *fstab, const char *path)
-{
+struct fstab_rec* fs_mgr_get_entry_for_mount_point_after(struct fstab_rec* start_rec,
+ struct fstab* fstab,
+ const std::string& path) {
int i;
if (!fstab) {
- return NULL;
+ return nullptr;
}
if (start_rec) {
@@ -799,14 +800,14 @@
} else {
i = 0;
}
+
for (; i < fstab->num_entries; i++) {
- int len = strlen(fstab->recs[i].mount_point);
- if (strncmp(path, fstab->recs[i].mount_point, len) == 0 &&
- (path[len] == '\0' || path[len] == '/')) {
+ if (fstab->recs[i].mount_point && path == fstab->recs[i].mount_point) {
return &fstab->recs[i];
}
}
- return NULL;
+
+ return nullptr;
}
/*
diff --git a/libsync/tests/sync_test.cpp b/libsync/tests/sync_test.cpp
index f08e97e..0fb86d6 100644
--- a/libsync/tests/sync_test.cpp
+++ b/libsync/tests/sync_test.cpp
@@ -448,6 +448,41 @@
ASSERT_EQ(mergedFence.wait(100), 0);
}
+TEST(FenceTest, GetInfoActive) {
+ SyncTimeline timeline;
+ ASSERT_TRUE(timeline.isValid());
+
+ SyncFence fence(timeline, 1);
+ ASSERT_TRUE(fence.isValid());
+
+ vector<SyncPointInfo> info = fence.getInfo();
+ ASSERT_EQ(info.size(), 1);
+
+ ASSERT_FALSE(info[0].driverName.empty());
+ ASSERT_FALSE(info[0].objectName.empty());
+ ASSERT_EQ(info[0].timeStampNs, 0);
+ ASSERT_EQ(info[0].status, 0);
+}
+
+TEST(FenceTest, GetInfoSignaled) {
+ SyncTimeline timeline;
+ ASSERT_TRUE(timeline.isValid());
+
+ SyncFence fence(timeline, 1);
+ ASSERT_TRUE(fence.isValid());
+
+ ASSERT_EQ(timeline.inc(1), 0);
+ ASSERT_EQ(fence.wait(), 0);
+
+ vector<SyncPointInfo> info = fence.getInfo();
+ ASSERT_EQ(info.size(), 1);
+
+ ASSERT_FALSE(info[0].driverName.empty());
+ ASSERT_FALSE(info[0].objectName.empty());
+ ASSERT_GT(info[0].timeStampNs, 0);
+ ASSERT_EQ(info[0].status, 1);
+}
+
TEST(StressTest, TwoThreadsSharedTimeline) {
const int iterations = 1 << 16;
int counter = 0;