rust-windowing / rust-windowing/winit

Android: Disconnecting USB-connected touch screen hangs eventloop indefinitely

Open
#4,674 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

B - bug DS - android
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

Description

We are using winit for a renderer that runs on Android boards of touch screen vending machines. There usually is a screen connected to the android board via HDMI for video input and via a separate USB cable for touch input.

If the touch input USB cable is disconnected while the winit app is running, it hangs indefinitely until it is killed by the window manager after some minutes.

Here are some logs we captured that point to places in winit that might be responsible:

08-25 22:12:11.141 13197 13216 W our-android-app: winit::platform_impl::android: TODO: forward saveState notification to application
08-25 22:12:11.143 13197 13216 W our-android-app: winit::platform_impl::android: TODO: forward onStop notification to application
08-25 22:12:11.150   232 14711 E ROCKCHIP_VIDEO_DECCONTROL: Rkvpu_Frame2Outbuf(938): mWidth = 1788 mHeight = 1080 mStride = 1792,mSlicHeight 1088
08-25 22:12:11.169   480   577 I ActivityManager: Start proc 14999:com.android.mtp/u0a5 for broadcast com.android.mtp/.UsbIntentReceiver
08-25 22:12:11.170 13197 13216 W our-android-app: winit::platform_impl::android: TODO: forward onDestroy notification to application
...
08-25 22:15:12.193   480   660 I InputDispatcher: Application is not responding: Window{e545855 u0 com.our.app/android.app.NativeActivity}.  It has been 5005.9ms since event, 5005.5ms since wait started.  Reason: Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 14.  Wait queue head age: 150362.2ms.
08-25 22:15:12.198   480   660 I WindowManager: Input event dispatching timed out sending to com.our.app/android.app.NativeActivity.  Reason: Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 14.  Wait queue head age: 150362.2ms.
08-25 22:15:12.235   480   577 I Process : Sending signal. PID: 13197 SIG: 3
...
08-25 22:15:13.738   480   577 E ActivityManager: ANR in com.our.app (com.our.app/android.app.NativeActivity)
08-25 22:15:13.738   480   577 E ActivityManager: Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 14.  Wait queue head age: 150362.2ms.)
08-25 22:15:13.738   480   577 E ActivityManager: Load: 0.45 / 3.27 / 4.05
...
08-25 22:15:13.739   480   578 W ActivityManager:   Force finishing activity com.our.app/android.app.NativeActivity
...
...
Device and Android version

some keys from getprop via adb shell:

[ro.build.version.release]: [7.1.2]
[ro.build.version.sdk]: [25]
[ro.product.cpu.abi]: [armeabi-v7a]
[ro.product.manufacturer]: [rockchip]
[ro.product.model]: [K518]

Android Board in TCN Vending machine similar to this one: https://www.tcnvend.com/tcn--hours-self-service-cbd-vending-machine-with-age-verification-248.html

Winit version

0.30.13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the disconnect on the reported Rockchip Android 7.1.2 device with winit 0.30.13, then trace the platform_impl::android lifecycle and input handling around the logged saveState, onStop, and onDestroy messages. Use the provided Android ANR and input-dispatch logs to identify where processing stops; done means disconnecting the USB touch screen no longer hangs the event loop or causes an ANR.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.