From 7d7f09d5561a6dec2cb20eb5b0956f11c942e2d8 Mon Sep 17 00:00:00 2001 From: Fabio Falsini Date: Mon, 19 Jul 2021 21:16:52 +0200 Subject: Add Android service check on quit app When quitApp() delegates the quit action to runAction(), this function only checks if an activity exists. If the process is a service, rather than an activity, it has no activity, so the action is skipped and the service is not exited. Check in runAction() for a service as well as an activity. Pick-to: 6.2 Change-Id: Iec6f0550064506a780892d3d840f7488fc894569 Reviewed-by: Edward Welbourne Reviewed-by: Assam Boudjelthia --- src/android/jar/src/org/qtproject/qt/android/QtNative.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/android/jar') diff --git a/src/android/jar/src/org/qtproject/qt/android/QtNative.java b/src/android/jar/src/org/qtproject/qt/android/QtNative.java index fcc14783db..c7e6c3b873 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtNative.java @@ -559,8 +559,8 @@ public class QtNative synchronized (m_mainActivityMutex) { final Looper mainLooper = Looper.getMainLooper(); final Handler handler = new Handler(mainLooper); - final boolean actionIsQueued = !m_activityPaused && m_activity != null && mainLooper != null && handler.post(action); - if (!actionIsQueued) + final boolean active = (m_activity != null && !m_activityPaused) || m_service != null; + if (!active || mainLooper == null || !handler.post(action)) m_lostActions.add(action); } } -- cgit v1.2.3