Android: Don't hang when resuming the application

If the main thread is blocked updateApplicationState will hang. It
happens when we're using functions like runOnAndroidThreadSync or
requestPermissionsSync.

Change-Id: Ic1135c5630b48cf1076ef5cbc133933fce439bfb
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
BogDan Vatra 2016-09-08 12:45:20 +03:00
parent bd4d847903
commit 734da261a8

View File

@ -672,11 +672,6 @@ static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state
QAndroidEventDispatcherStopper::instance()->goingToStop(true);
QCoreApplication::processEvents();
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(state));
{
AndroidDeadlockProtector protector;
if (protector.acquire())
QWindowSystemInterface::flushWindowSystemEvents();
}
if (state == Qt::ApplicationSuspended)
QAndroidEventDispatcherStopper::instance()->stopAll();
} else {