Android: rename isPluginRunning to isNativePluginIntegrationReady

This has been used to notify that the platform integration is
setup and ready, now the name is more descriptive of what it does.

Task-number: QTBUG-118077
Change-Id: I9fab525f07433f9ec8057e2475a3b1e4658f84d9
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
This commit is contained in:
Assam Boudjelthia 2023-11-22 01:23:09 +02:00
parent aea816b197
commit 57330a18ca
6 changed files with 15 additions and 23 deletions

View File

@ -208,7 +208,7 @@ public class QtActivityBase extends Activity
public boolean onKeyDown(int keyCode, KeyEvent event) public boolean onKeyDown(int keyCode, KeyEvent event)
{ {
QtNative.ApplicationStateDetails stateDetails = QtNative.getStateDetails(); QtNative.ApplicationStateDetails stateDetails = QtNative.getStateDetails();
if (!stateDetails.isStarted || !m_delegate.isPluginRunning()) if (!stateDetails.isStarted || !stateDetails.nativePluginIntegrationReady)
return false; return false;
return m_delegate.getInputDelegate().onKeyDown(keyCode, event); return m_delegate.getInputDelegate().onKeyDown(keyCode, event);
@ -218,7 +218,7 @@ public class QtActivityBase extends Activity
public boolean onKeyUp(int keyCode, KeyEvent event) public boolean onKeyUp(int keyCode, KeyEvent event)
{ {
QtNative.ApplicationStateDetails stateDetails = QtNative.getStateDetails(); QtNative.ApplicationStateDetails stateDetails = QtNative.getStateDetails();
if (!stateDetails.isStarted || !m_delegate.isPluginRunning()) if (!stateDetails.isStarted || !stateDetails.nativePluginIntegrationReady)
return false; return false;
return m_delegate.getInputDelegate().onKeyUp(keyCode, event); return m_delegate.getInputDelegate().onKeyUp(keyCode, event);

View File

@ -37,8 +37,6 @@ public class QtActivityDelegate
{ {
private Activity m_activity; private Activity m_activity;
private boolean m_isPluginRunning = false;
private HashMap<Integer, QtSurface> m_surfaces = null; private HashMap<Integer, QtSurface> m_surfaces = null;
private HashMap<Integer, View> m_nativeViews = null; private HashMap<Integer, View> m_nativeViews = null;
private QtLayout m_layout = null; private QtLayout m_layout = null;
@ -97,11 +95,6 @@ public class QtActivityDelegate
}); });
} }
boolean isPluginRunning()
{
return m_isPluginRunning;
}
void setContextMenuVisible(boolean contextMenuVisible) void setContextMenuVisible(boolean contextMenuVisible)
{ {
m_contextMenuVisible = contextMenuVisible; m_contextMenuVisible = contextMenuVisible;
@ -300,12 +293,6 @@ public class QtActivityDelegate
m_accessibilityDelegate.notifyScrolledEvent(viewId); m_accessibilityDelegate.notifyScrolledEvent(viewId);
} }
@UsedFromNativeCode
public void notifyQtAndroidPluginRunning(boolean running)
{
m_isPluginRunning = running;
}
@UsedFromNativeCode @UsedFromNativeCode
public void initializeAccessibility() public void initializeAccessibility()
{ {

View File

@ -203,6 +203,7 @@ public class QtNative
public static class ApplicationStateDetails { public static class ApplicationStateDetails {
int state = ApplicationState.ApplicationSuspended; int state = ApplicationState.ApplicationSuspended;
boolean nativePluginIntegrationReady = false;
boolean isStarted = false; boolean isStarted = false;
} }
@ -216,6 +217,12 @@ public class QtNative
m_stateDetails.isStarted = started; m_stateDetails.isStarted = started;
} }
@UsedFromNativeCode
public static void notifyNativePluginIntegrationReady(boolean ready)
{
m_stateDetails.nativePluginIntegrationReady = ready;
}
public static void setApplicationState(int state) public static void setApplicationState(int state)
{ {
synchronized (m_mainActivityMutex) { synchronized (m_mainActivityMutex) {

View File

@ -99,6 +99,7 @@ namespace QtAndroid
void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration) void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration)
{ {
m_androidPlatformIntegration = androidPlatformIntegration; m_androidPlatformIntegration = androidPlatformIntegration;
QtAndroid::notifyNativePluginIntegrationReady((bool)m_androidPlatformIntegration);
// flush the pending state if necessary. // flush the pending state if necessary.
if (m_androidPlatformIntegration && (m_pendingApplicationState != -1)) { if (m_androidPlatformIntegration && (m_pendingApplicationState != -1)) {
@ -213,9 +214,11 @@ namespace QtAndroid
qtActivityDelegate().callMethod<void>("notifyScrolledEvent", accessibilityObjectId); qtActivityDelegate().callMethod<void>("notifyScrolledEvent", accessibilityObjectId);
} }
void notifyQtAndroidPluginRunning(bool running) void notifyNativePluginIntegrationReady(bool ready)
{ {
qtActivityDelegate().callMethod<void>("notifyQtAndroidPluginRunning", running); QJniObject::callStaticMethod<void>(m_applicationClass,
"notifyNativePluginIntegrationReady",
ready);
} }
jobject createBitmap(QImage img, JNIEnv *env) jobject createBitmap(QImage img, JNIEnv *env)

View File

@ -75,7 +75,7 @@ namespace QtAndroid
void notifyObjectFocus(uint accessibilityObjectId); void notifyObjectFocus(uint accessibilityObjectId);
void notifyValueChanged(uint accessibilityObjectId, jstring value); void notifyValueChanged(uint accessibilityObjectId, jstring value);
void notifyScrolledEvent(uint accessibilityObjectId); void notifyScrolledEvent(uint accessibilityObjectId);
void notifyQtAndroidPluginRunning(bool running); void notifyNativePluginIntegrationReady(bool ready);
const char *classErrorMsgFmt(); const char *classErrorMsgFmt();
const char *methodErrorMsgFmt(); const char *methodErrorMsgFmt();

View File

@ -54,7 +54,6 @@ Qt::ScreenOrientation QAndroidPlatformIntegration::m_orientation = Qt::PrimaryOr
Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::PrimaryOrientation; Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::PrimaryOrientation;
bool QAndroidPlatformIntegration::m_showPasswordEnabled = false; bool QAndroidPlatformIntegration::m_showPasswordEnabled = false;
static bool m_running = false;
Q_DECLARE_JNI_CLASS(QtNative, "org/qtproject/qt/android/QtNative") Q_DECLARE_JNI_CLASS(QtNative, "org/qtproject/qt/android/QtNative")
Q_DECLARE_JNI_CLASS(QtDisplayManager, "org/qtproject/qt/android/QtDisplayManager") Q_DECLARE_JNI_CLASS(QtDisplayManager, "org/qtproject/qt/android/QtDisplayManager")
@ -159,10 +158,6 @@ void QAndroidPlatformNativeInterface::customEvent(QEvent *event)
api->accessibility()->setActive(QtAndroidAccessibility::isActive()); api->accessibility()->setActive(QtAndroidAccessibility::isActive());
#endif // QT_CONFIG(accessibility) #endif // QT_CONFIG(accessibility)
if (!m_running) {
m_running = true;
QtAndroid::notifyQtAndroidPluginRunning(m_running);
}
api->flushPendingUpdates(); api->flushPendingUpdates();
} }