Limit the number of printed entries in a queue

When debugging some input bugs, it takes a while to scroll through all
of the entries in waitQueues and outboundQueues.
For example, the count can be > 100 for some ANR scenarios.

Limit the number to 50 total entries printed: 25 oldest and 25 newest.
This quantity should be sufficient to figure out what's going on with
the queues.

Note: I could not reproduce the ANR anymore, so the latest patchset was
not tested using the first test procedure.

Bug: 160561987
Test: reproduce an ANR using monkey, then look at dumpsys input
adb shell monkey 10000
adb shell dumpsys input
Test: the above procedure, but without 'reproduce ANR'

Change-Id: I01d661e0a85cc5bfbf61fa4b23689e8b27daa84b
diff --git a/services/inputflinger/dispatcher/Entry.h b/services/inputflinger/dispatcher/Entry.h
index d5b589e..ace57f1 100644
--- a/services/inputflinger/dispatcher/Entry.h
+++ b/services/inputflinger/dispatcher/Entry.h
@@ -81,9 +81,7 @@
 
     void release();
 
-    virtual void appendDescription(std::string& msg) const = 0;
-
-    std::string getDescription() const;
+    virtual std::string getDescription() const = 0;
 
 protected:
     EventEntry(int32_t id, Type type, nsecs_t eventTime, uint32_t policyFlags);
@@ -93,7 +91,7 @@
 
 struct ConfigurationChangedEntry : EventEntry {
     explicit ConfigurationChangedEntry(int32_t id, nsecs_t eventTime);
-    virtual void appendDescription(std::string& msg) const;
+    std::string getDescription() const override;
 
 protected:
     virtual ~ConfigurationChangedEntry();
@@ -103,7 +101,7 @@
     int32_t deviceId;
 
     DeviceResetEntry(int32_t id, nsecs_t eventTime, int32_t deviceId);
-    virtual void appendDescription(std::string& msg) const;
+    std::string getDescription() const override;
 
 protected:
     virtual ~DeviceResetEntry();
@@ -116,7 +114,7 @@
 
     FocusEntry(int32_t id, nsecs_t eventTime, sp<IBinder> connectionToken, bool hasFocus,
                std::string_view reason);
-    virtual void appendDescription(std::string& msg) const;
+    std::string getDescription() const override;
 
 protected:
     virtual ~FocusEntry();
@@ -148,7 +146,7 @@
     KeyEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source, int32_t displayId,
              uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode,
              int32_t metaState, int32_t repeatCount, nsecs_t downTime);
-    virtual void appendDescription(std::string& msg) const;
+    std::string getDescription() const override;
     void recycle();
 
 protected:
@@ -182,7 +180,7 @@
                 float yCursorPosition, nsecs_t downTime, uint32_t pointerCount,
                 const PointerProperties* pointerProperties, const PointerCoords* pointerCoords,
                 float xOffset, float yOffset);
-    virtual void appendDescription(std::string& msg) const;
+    std::string getDescription() const override;
 
 protected:
     virtual ~MotionEntry();