Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139659

Activity can stop reacting to touch events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.9.2
    • GUI: Window management
    • None
    • Samsung phone with Android 14, possibly other devices
    • Android
    • a113197fe (dev), 339e84103 (6.10), 6232e1fcd (6.9)
    • 2025wk40s2-3QtforAndroid

      This is a regression of Qt 6.9.2 and in particular commit 5ef73686cfb488dfc6a4077a2ecb12f883de1461 (Re-land: Android: destroy the window surface only after exit transition). If I revert this commit the problem no longer occurs. I'm not sure whether the underlying source of the problem is that commit, though.

      The problem on the surface is that the Android activity can end up in a state where it no longer reacts to input events and instead just logs "Touch event received for non-existing window 1" when one occurs.

      I suspect that commit 5ef73686cfb488dfc6a4077a2ecb12f883de1461 might cause Qt to no longer update its internal tracking of the current window in some cases.

      Unfortunately I don't know a simple way to reproduce the issue. I wasn't able to reproduce it with an x86-64 build in the Android emulator. I was only able to reproduce it with my main real testing device, an aach64 Samsung phone on Android 14. There I can trigger the problematic situation reliably, though. So this is not a sporadic issue. It happens it I let Android destroy the activity (e.g. by moving it out of the activity switcher). I'm not sure whether that's relevant but for my app this means the activity process is destroyed but the service process keeps running (as my app has a service that runs in a separate process). When I then re-open the activity I get a weird flickering on startup. This also happened in Qt 6.9.1 (without  5ef73686cfb488dfc6a4077a2ecb12f883de1461) where Qt was nevertheless able to process input events after the flickering. As of  5ef73686cfb488dfc6a4077a2ecb12f883de1461 Qt is no longer able to handle input events after the flickering. Note that Qt is still able to update/redraw the activity contents even after 5ef73686cfb488dfc6a4077a2ecb12f883de1461, e.g. the traffic statistics my app shows are updated. So this really only seems to affect the input handling but not the drawing.

      I suppose the "flickering" is caused by Android recreating something and before 6.9.2 Qt was able to cope with that and now it no longer is.

      Maybe flickering is caused by the activity process never stopping cleanly as I had to use QT_ANDROID_NO_EXIT_CALL in that app. The activity process is nevertheless supposed to stop and it also does in the Android emulator according to the "Device Explorer" in Android Studio. I'm not sure how to verify this on the real device.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qtandroidteam Qt Android Team
            martchus martchus
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: