diff options
| author | 2023-08-29 13:20:02 +0000 | |
|---|---|---|
| committer | 2023-09-14 20:37:30 +0000 | |
| commit | 6bf1032b01bbbe6956623ae501f96d9964d0e39b (patch) | |
| tree | 377ce455216bdd0de5127a81e8c0d36e57534f5b | |
| parent | 284bd4bf1690edf15370064639d1abd605be9d3d (diff) | |
fix(magnifier): avoid crash when smashing magnifier shortcut button repeatedly
This avoids a race condition where we start receiving events and
trying to send them to the input filter before it's been
installed.
Fix: 290271948
Test: manual:
1. Turn on magnification shortcut button
2. Tap it repeatedly quickly for like 30 seconds
3. Should not crash.
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f509803cad6652c79871bb0a7b509ba2d1054b67)
Merged-In: I24f0eafb2479ac7427ba28077e45ba26a9127cc8
Change-Id: I24f0eafb2479ac7427ba28077e45ba26a9127cc8
| -rw-r--r-- | services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java index 8e7d27795c07..2519f4e7f3e3 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java @@ -388,11 +388,19 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo @Override public void onMotionEvent(MotionEvent transformedEvent, MotionEvent rawEvent, int policyFlags) { + if (!mInstalled) { + Slog.w(TAG, "onMotionEvent called before input filter installed!"); + return; + } sendInputEvent(transformedEvent, policyFlags); } @Override public void onKeyEvent(KeyEvent event, int policyFlags) { + if (!mInstalled) { + Slog.w(TAG, "onKeyEvent called before input filter installed!"); + return; + } sendInputEvent(event, policyFlags); } |