Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
5.12.8
-
None
Description
When an Android application is set to allow the QtEvent loop to run while the application is in the suspended state, calling QtAndroid::runOnAndroidThread events get queued and calling QtAndroid::runOnAndroidThreadSync will in turn cause Qt's main thread to then be blocked.
In the below code snippet, it is queueing based solely on if the activity is paused, I believe it should also check for the background_running value set in the Android manifest as well.
private static void runPendingCppRunnablesOnAndroidThread() { synchronized (m_mainActivityMutex) { if (m_activity != null) { if (!m_activityPaused) m_activity.runOnUiThread(runPendingCppRunnablesRunnable); else runAction(runPendingCppRunnablesRunnable); } else { final Looper mainLooper = Looper.getMainLooper(); final Thread looperThread = mainLooper.getThread(); if (looperThread.equals(Thread.currentThread())) { runPendingCppRunnablesRunnable.run(); } else { final Handler handler = new Handler(mainLooper); handler.post(runPendingCppRunnablesRunnable); } } } }
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-83475 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
297198,2 | Android: allow runOnAndroidThread to function while suspended | 5.15 | qt/qtbase | Status: NEW | -1 | 0 |
297087,4 | Android: allow runOnAndroidThread to function while suspended | 5.12 | qt/qtbase | Status: ABANDONED | 0 | 0 |