Skip to content

Commit 3d5da49

Browse files
prabirmspAndroid (Google) Code Review
authored andcommitted
Merge "inputflinger: Remove anonymous namespaces from headers" into main
2 parents 1e2515d + bf20e95 commit 3d5da49

3 files changed

Lines changed: 20 additions & 21 deletions

File tree

libs/input/tests/TestEventMatchers.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,8 @@
2727

2828
namespace android {
2929

30-
namespace {
31-
3230
using ::testing::Matcher;
3331

34-
} // namespace
35-
3632
/**
3733
* This file contains a copy of Matchers from .../inputflinger/tests/TestEventMatchers.h. Ideally,
3834
* implementations must not be duplicated.

services/inputflinger/tests/TestEventMatchers.h

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232

3333
namespace android {
3434

35-
namespace {
35+
struct PointF {
36+
float x;
37+
float y;
38+
auto operator<=>(const PointF&) const = default;
39+
};
40+
41+
namespace internal {
3642

3743
template <typename T>
3844
static bool valuesMatch(T value1, T value2) {
@@ -43,17 +49,11 @@ static bool valuesMatch(T value1, T value2) {
4349
}
4450
}
4551

46-
struct PointF {
47-
float x;
48-
float y;
49-
auto operator<=>(const PointF&) const = default;
50-
};
51-
5252
inline std::string pointFToString(const PointF& p) {
5353
return std::string("(") + std::to_string(p.x) + ", " + std::to_string(p.y) + ")";
5454
}
5555

56-
} // namespace
56+
} // namespace internal
5757

5858
/// Source
5959
class WithSourceMatcher {
@@ -453,8 +453,10 @@ class WithPointersMatcher {
453453
}
454454

455455
if (mPointers != actualPointers) {
456-
*os << "expected pointers " << dumpMap(mPointers, constToString, pointFToString)
457-
<< ", but got " << dumpMap(actualPointers, constToString, pointFToString);
456+
*os << "expected pointers "
457+
<< dumpMap(mPointers, constToString, internal::pointFToString)
458+
<< ", but got "
459+
<< dumpMap(actualPointers, constToString, internal::pointFToString);
458460
return false;
459461
}
460462
return true;
@@ -469,15 +471,17 @@ class WithPointersMatcher {
469471
}
470472

471473
if (mPointers != actualPointers) {
472-
*os << "expected pointers " << dumpMap(mPointers, constToString, pointFToString)
473-
<< ", but got " << dumpMap(actualPointers, constToString, pointFToString);
474+
*os << "expected pointers "
475+
<< dumpMap(mPointers, constToString, internal::pointFToString)
476+
<< ", but got "
477+
<< dumpMap(actualPointers, constToString, internal::pointFToString);
474478
return false;
475479
}
476480
return true;
477481
}
478482

479483
void DescribeTo(std::ostream* os) const {
480-
*os << "with pointers " << dumpMap(mPointers, constToString, pointFToString);
484+
*os << "with pointers " << dumpMap(mPointers, constToString, internal::pointFToString);
481485
}
482486

483487
void DescribeNegationTo(std::ostream* os) const { *os << "wrong pointers"; }
@@ -721,8 +725,9 @@ class WithRelativeMotionMatcher {
721725
}
722726

723727
const PointerCoords& coords = event.pointerCoords[mPointerIndex];
724-
bool matches = valuesMatch(mRelX, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X)) &&
725-
valuesMatch(mRelY, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y));
728+
bool matches =
729+
internal::valuesMatch(mRelX, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X)) &&
730+
internal::valuesMatch(mRelY, coords.getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y));
726731
if (!matches) {
727732
*os << "expected relative motion (" << mRelX << ", " << mRelY << ") at pointer index "
728733
<< mPointerIndex << ", but got ("

services/inputflinger/tests/fuzzers/FuzzedInputStream.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818

1919
namespace android {
2020

21-
namespace {
2221
static constexpr int32_t MAX_RANDOM_POINTERS = 4;
2322
static constexpr int32_t MAX_RANDOM_DEVICES = 4;
24-
} // namespace
2523

2624
int getFuzzedMotionAction(FuzzedDataProvider& fdp) {
2725
int actionMasked = fdp.PickValueInArray<int>({

0 commit comments

Comments
 (0)