Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a33291e6 authored by Chris Ye's avatar Chris Ye
Browse files

Add event log for view_enqueue_input_event.

Log out the input events to help debugging unresponsive UI issues.

Examples:
06-15 19:00:53.725  2272  2272 I view_enqueue_input_event: [Motion - Cancel,NavigationBar0]
06-16 02:28:35.318  3650  3650 I view_enqueue_input_event: [Key - Cancel,com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity]

Bug: 154660150
Test: Manual test of swiping screen and watch event log.

Change-Id: I08c6be21ec01d9da2c67e2b59c15ba780de227be
parent 67a1b20b
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
# See system/core/logcat/event.logtags for a description of the format of this file.

option java_package android.view

# The entries in this file map a sparse set of log tag numbers to tag names.
# This is installed on the device, in /system/etc, and parsed by logcat.
#
# Tag numbers are decimal integers, from 0 to 2^31.  (Let's leave the
# negative values alone for now.)
#
# Tag names are one or more ASCII letters and numbers or underscores, i.e.
# "[A-Z][a-z][0-9]_".  Do not include spaces or punctuation (the former
# impacts log readability, the latter makes regex searches more annoying).
#
# Tag numbers and names are separated by whitespace.  Blank lines and lines
# starting with '#' are ignored.
#
# Optionally, after the tag names can be put a description for the value(s)
# of the tag. Description are in the format
#    (<name>|data type[|data unit])
# Multiple values are separated by commas.
#
# The data type is a number from the following values:
# 1: int
# 2: long
# 3: string
# 4: list
#
# The data unit is a number taken from the following list:
# 1: Number of objects
# 2: Number of bytes
# 3: Number of milliseconds
# 4: Number of allocations
# 5: Id
# 6: Percent
# Default value for data of type int/long is 2 (bytes).
#
# See system/core/logcat/event.logtags for the master copy of the tags.

# 62000 - 62199 reserved for inputflinger

# ---------------------------
# android.view
# ---------------------------
# Enqueue Input Event
62002 view_enqueue_input_event (eventType|3),(action|3)

# NOTE - the range 1000000-2000000 is reserved for partners and others who
# want to define their own log tags without conflicting with the core platform.
 No newline at end of file
+14 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ import android.os.UserHandle;
import android.sysprop.DisplayProperties;
import android.util.AndroidRuntimeException;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
import android.util.LongArray;
import android.util.MergedConfiguration;
@@ -7946,6 +7947,19 @@ public final class ViewRootImpl implements ViewParent,
            InputEventReceiver receiver, int flags, boolean processImmediately) {
        QueuedInputEvent q = obtainQueuedInputEvent(event, receiver, flags);

        if (event instanceof MotionEvent) {
            MotionEvent me = (MotionEvent) event;
            if (me.getAction() == MotionEvent.ACTION_CANCEL) {
                EventLog.writeEvent(EventLogTags.VIEW_ENQUEUE_INPUT_EVENT, "Motion - Cancel",
                        getTitle());
            }
        } else if (event instanceof KeyEvent) {
            KeyEvent ke = (KeyEvent) event;
            if (ke.isCanceled()) {
                EventLog.writeEvent(EventLogTags.VIEW_ENQUEUE_INPUT_EVENT, "Key - Cancel",
                        getTitle());
            }
        }
        // Always enqueue the input event in order, regardless of its time stamp.
        // We do this because the application or the IME may inject key events
        // in response to touch events and we want to ensure that the injected keys