Android: Make sure applicationState is set correctly
The Activity onResume function is always called before the application gets initialized and we let the applicationState set to the default value which is AppicationInactive. Change-Id: Ifc3c7e3dfc51f2b821f8ca87f8b711f485b6a6f8 Reviewed-by: Peter Rustler <peter.rustler@basyskom.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
This commit is contained in:
parent
9d19753bfa
commit
1ee25cedb4
@ -866,8 +866,8 @@ public class QtActivityDelegate
|
||||
while (itr.hasNext())
|
||||
m_activity.runOnUiThread(itr.next());
|
||||
|
||||
if (m_started) {
|
||||
QtNative.updateApplicationState(ApplicationActive);
|
||||
if (m_started) {
|
||||
QtNative.clearLostActions();
|
||||
QtNative.updateWindow();
|
||||
updateFullScreen(); // Suspending the app clears the immersive mode, so we need to set it again.
|
||||
|
@ -589,8 +589,10 @@ static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state
|
||||
{
|
||||
m_activityActive = (state == Qt::ApplicationActive);
|
||||
|
||||
if (!m_main || !m_androidPlatformIntegration || !QGuiApplicationPrivate::platformIntegration())
|
||||
if (!m_main || !m_androidPlatformIntegration || !QGuiApplicationPrivate::platformIntegration()) {
|
||||
QAndroidPlatformIntegration::setDefaultApplicationState(Qt::ApplicationState(state));
|
||||
return;
|
||||
}
|
||||
|
||||
if (state <= Qt::ApplicationInactive) {
|
||||
// Don't send timers and sockets events anymore if we are going to hide all windows
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "qandroidplatformintegration.h"
|
||||
|
||||
#include <QtCore/private/qjni_p.h>
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QGuiApplication>
|
||||
#include <QOpenGLContext>
|
||||
#include <QThread>
|
||||
@ -72,6 +73,8 @@ int QAndroidPlatformIntegration::m_defaultPhysicalSizeHeight = 71;
|
||||
Qt::ScreenOrientation QAndroidPlatformIntegration::m_orientation = Qt::PrimaryOrientation;
|
||||
Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::PrimaryOrientation;
|
||||
|
||||
Qt::ApplicationState QAndroidPlatformIntegration::m_defaultApplicationState = Qt::ApplicationActive;
|
||||
|
||||
void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
|
||||
{
|
||||
if (resource=="JavaVM")
|
||||
@ -176,6 +179,8 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶
|
||||
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
|
||||
}
|
||||
}
|
||||
|
||||
QGuiApplicationPrivate::instance()->setApplicationState(m_defaultApplicationState);
|
||||
}
|
||||
|
||||
bool QAndroidPlatformIntegration::needsBasicRenderloopWorkaround()
|
||||
|
@ -115,6 +115,7 @@ public:
|
||||
|
||||
QTouchDevice *touchDevice() const { return m_touchDevice; }
|
||||
void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; }
|
||||
static void setDefaultApplicationState(Qt::ApplicationState applicationState) { m_defaultApplicationState = applicationState; }
|
||||
|
||||
EGLDisplay m_eglDisplay;
|
||||
private:
|
||||
@ -136,6 +137,8 @@ private:
|
||||
static Qt::ScreenOrientation m_orientation;
|
||||
static Qt::ScreenOrientation m_nativeOrientation;
|
||||
|
||||
static Qt::ApplicationState m_defaultApplicationState;
|
||||
|
||||
QPlatformFontDatabase *m_androidFDB;
|
||||
QImage *m_FbScreenImage;
|
||||
QPainter *m_compositePainter;
|
||||
|
Loading…
x
Reference in New Issue
Block a user