Android: Pass pending state to ResumePauseListener

It can happen that updateApplicationState() is called before
m_androidPlatformIntegration is set. In such case, new applicationState
will be remembered and propagated later.

Before this change, pending application state was passed only to
QWindowSystemInterface.

ResumePauseListeners that are subscribed for changes to
ApplicationActive/ApplicationInactive state also should be informed
about new application state.

Fixes: QTBUG-84737
Pick-to: 6.0 5.15
Change-Id: I67e79860b340ee5de2d13d148a222e9f1c942b93
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Bartlomiej Moskal 2020-12-03 13:36:42 +01:00
parent 3bc398f766
commit 2eb77139a2

View File

@ -135,8 +135,13 @@ namespace QtAndroid
m_androidPlatformIntegration = androidPlatformIntegration;
// flush the pending state if necessary.
if (m_androidPlatformIntegration && (m_pendingApplicationState != -1))
if (m_androidPlatformIntegration && (m_pendingApplicationState != -1)) {
if (m_pendingApplicationState == Qt::ApplicationActive)
QtAndroidPrivate::handleResume();
else if (m_pendingApplicationState == Qt::ApplicationInactive)
QtAndroidPrivate::handlePause();
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(m_pendingApplicationState));
}
m_pendingApplicationState = -1;
}