Log creation and removal of monitors

To help investigate "no swipe-up to go home" gesture issue, add a log
for when gesture monitors are added or removed.

Bug: 182478748
Test: Use TestDPC apk to set up a work profile on the device. Then run
'logcatcolor | grep -i monitor' to check the logs. Turn work profile off
and then on again
Observe: logs when work profile is turned on
04-22 02:29:01.495  5422  5516 I InputDispatcher: Erasing monitor swipe-up (server) on display 0, pid=6132
04-22 02:29:01.548  6132  6132 D TouchInteractionService b/182478748: TouchInteractionService.initInputMonitor: user=0
04-22 02:29:01.548  6132  6132 D TouchInteractionService b/182478748: create swipe-up input monitor: user=0
04-22 02:29:01.552  5422 11731 I InputDispatcher: Created monitor swipe-up for display 0, gesture=true, pid=6132
04-22 02:29:01.553  6132  6132 D TouchInteractionService b/182478748: TouchInteractionService.initInputMonitor: user=0
04-22 02:29:01.554  6132  6132 D TouchInteractionService b/182478748: create swipe-up input monitor: user=0
04-22 02:29:01.554  5422  6315 I InputDispatcher: Created monitor swipe-up for display 0, gesture=true, pid=6132
04-22 02:29:01.557  5422  5516 I InputDispatcher: Erasing monitor swipe-up (server) on display 0, pid=6132
04-22 02:29:01.573  6132  6132 D TouchInteractionService b/182478748: TouchInteractionService.initInputMonitor: user=0
04-22 02:29:01.574  6132  6132 D TouchInteractionService b/182478748: create swipe-up input monitor: user=0
04-22 02:29:01.575  5422  5516 I InputDispatcher: Erasing monitor swipe-up (server) on display 0, pid=6132
04-22 02:29:01.577  5422  5689 I InputDispatcher: Created monitor swipe-up for display 0, gesture=true, pid=6132

Change-Id: Iaa035fa977f9120e42b91c80a48bc8b6d1fe7003
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 8277f51..edbf21a 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -5100,6 +5100,8 @@
         monitorsByDisplay[displayId].emplace_back(serverChannel, pid);
 
         mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, handleReceiveCallback, this);
+        ALOGI("Created monitor %s for display %" PRId32 ", gesture=%s, pid=%" PRId32, name.c_str(),
+              displayId, toString(isGestureMonitor), pid);
     }
 
     // Wake the looper because some connections have changed.
@@ -5160,6 +5162,8 @@
         const size_t numMonitors = monitors.size();
         for (size_t i = 0; i < numMonitors; i++) {
             if (monitors[i].inputChannel->getConnectionToken() == connectionToken) {
+                ALOGI("Erasing monitor %s on display %" PRId32 ", pid=%" PRId32,
+                      monitors[i].inputChannel->getName().c_str(), it->first, monitors[i].pid);
                 monitors.erase(monitors.begin() + i);
                 break;
             }