Log windows that are being interacted with
If the list of windows being interacted with changes, log the new list
to event log.
Example logs:
06-08 15:47:55.349 4105 4181 I input_interaction: Interaction with windows: ee638df NotificationShade (server),
06-08 15:48:03.917 4105 4181 I input_interaction: Interaction with windows: 399b259 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity (server),
06-08 15:48:10.844 4105 4181 I input_interaction: Interaction with windows: fcc1e60 com.android.systemui.ImageWallpaper (server), 399b259 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity (server),
06-08 15:49:30.091 4105 4181 I input_interaction: Interaction with windows: ee638df NotificationShade (server),
06-08 15:49:31.757 4105 4181 I input_interaction: Interaction with windows: fcc1e60 com.android.systemui.ImageWallpaper (server), 399b259 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity (server),
06-08 15:49:33.293 4105 4181 I input_interaction: Interaction with windows: <none>
Bug: 153092301
Test: adb logcat -b events | grep -i input
Change-Id: Ia4216beb200163e60e05374b6ea363412bff55f3
Merged-In: Ia4216beb200163e60e05374b6ea363412bff55f3
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 0c3ea36..1980435 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -48,6 +48,7 @@
#include <deque>
#include <optional>
#include <unordered_map>
+#include <unordered_set>
#include <InputListener.h>
#include <InputReporterInterface.h>
@@ -323,6 +324,11 @@
// Dispatcher state at time of last ANR.
std::string mLastAnrState GUARDED_BY(mLock);
+ // The connection token of the channel that was last interacted with.
+ std::unordered_set<sp<IBinder>, IBinderHash> mInteractionConnections GUARDED_BY(mLock);
+ void updateInteractionTokensLocked(const EventEntry& entry,
+ const std::vector<InputTarget>& targets) REQUIRES(mLock);
+
// Dispatch inbound events.
bool dispatchConfigurationChangedLocked(nsecs_t currentTime, ConfigurationChangedEntry* entry)
REQUIRES(mLock);