Add pid to monitor
The dispatcher will now have pid information of each monitor. This
information will be used to raise ANRs.
Bug: 175593831
Test: atest inputflinger_tests
Change-Id: Ief3bbe36e06ac7c36039f08739fc10b3c2291530
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index bf05b9f..7333290 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -48,6 +48,9 @@
static const int32_t INJECTOR_PID = 999;
static const int32_t INJECTOR_UID = 1001;
+// An arbitrary pid of the gesture monitor window
+static constexpr int32_t MONITOR_PID = 2001;
+
struct PointF {
float x;
float y;
@@ -1781,7 +1784,7 @@
FakeMonitorReceiver(const sp<InputDispatcher>& dispatcher, const std::string name,
int32_t displayId, bool isGestureMonitor = false) {
base::Result<std::unique_ptr<InputChannel>> channel =
- dispatcher->createInputMonitor(displayId, isGestureMonitor, name);
+ dispatcher->createInputMonitor(displayId, isGestureMonitor, name, MONITOR_PID);
mInputReceiver = std::make_unique<FakeInputReceiver>(std::move(*channel), name);
}