Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qjnihelpers.cpp File Reference

(6b105c54eee069f6ddeeac41d9f93ad533f24586)

#include "qjnihelpers_p.h"
#include "qjnienvironment.h"
#include "qjniobject.h"
#include "qlist.h"
#include "qmutex.h"
#include "qsemaphore.h"
#include "qreadwritelock.h"
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qlocking_p.h>
#include <android/log.h>
#include <deque>
#include <memory>
+ Include dependency graph for qjnihelpers.cpp:

Go to the source code of this file.

Namespaces

namespace  QtAndroidPrivate
 \preliminary \inmodule QtCorePrivate
 

Functions

QT_BEGIN_NAMESPACE Q_DECLARE_JNI_CLASS (QtInputDelegate, "org/qtproject/qt/android/QtInputDelegate")
 
 Q_DECLARE_JNI_CLASS (MotionEvent, "android/view/MotionEvent")
 
 Q_DECLARE_JNI_CLASS (KeyEvent, "android/view/KeyEvent")
 
 Q_GLOBAL_STATIC (QSemaphore, g_waitForServiceSetupSemaphore)
 
 Q_GLOBAL_STATIC (QReadWriteLock, g_updateMutex)
 
static jboolean updateNativeActivity (JNIEnv *env, jclass=nullptr)
 
static jboolean dispatchGenericMotionEvent (JNIEnv *, jclass, QtJniTypes::MotionEvent event)
 
 Q_DECLARE_JNI_NATIVE_METHOD (dispatchGenericMotionEvent)
 
static jboolean dispatchKeyEvent (JNIEnv *, jclass, QtJniTypes::KeyEvent event)
 
 Q_DECLARE_JNI_NATIVE_METHOD (dispatchKeyEvent)
 
Q_CORE_EXPORT jobject qt_androidActivity ()
 
Q_CORE_EXPORT jobject qt_androidService ()
 
QT_END_NAMESPACE JNIEXPORT jint JNICALL JNI_OnLoad (JavaVM *vm, void *reserved)
 

Variables

static JavaVM * g_javaVM = nullptr
 
static jobject g_jActivity = nullptr
 
static jobject g_jService = nullptr
 
static jobject g_jClassLoader = nullptr
 
static Q_CONSTINIT QtAndroidPrivate::OnBindListenerg_onBindListener
 
static Q_CONSTINIT QBasicMutex g_onBindListenerMutex
 
static Q_CONSTINIT QBasicAtomicInt g_serviceSetupLockers = Q_BASIC_ATOMIC_INITIALIZER(0)
 
static Q_CONSTINIT QBasicAtomicInt g_androidDeadlockProtector = Q_BASIC_ATOMIC_INITIALIZER(0)
 

Function Documentation

◆ dispatchGenericMotionEvent()

static jboolean dispatchGenericMotionEvent ( JNIEnv * ,
jclass ,
QtJniTypes::MotionEvent event )
static

Definition at line 157 of file qjnihelpers.cpp.

References mutex, and ret.

Referenced by QtAndroidPrivate::initJNI().

+ Here is the caller graph for this function:

◆ dispatchKeyEvent()

static jboolean dispatchKeyEvent ( JNIEnv * ,
jclass ,
QtJniTypes::KeyEvent event )
static

Definition at line 176 of file qjnihelpers.cpp.

References mutex, and ret.

Referenced by QtAndroidPrivate::initJNI().

+ Here is the caller graph for this function:

◆ JNI_OnLoad()

QT_END_NAMESPACE JNIEXPORT jint JNICALL JNI_OnLoad ( JavaVM * vm,
void * reserved )

Definition at line 428 of file qjnihelpers.cpp.

References QtAndroidPrivate::initJNI(), logTag, Q_UNUSED, and ret.

+ Here is the call graph for this function:

◆ Q_DECLARE_JNI_CLASS() [1/3]

Q_DECLARE_JNI_CLASS ( KeyEvent ,
"android/view/KeyEvent"  )

◆ Q_DECLARE_JNI_CLASS() [2/3]

Q_DECLARE_JNI_CLASS ( MotionEvent ,
"android/view/MotionEvent"  )

◆ Q_DECLARE_JNI_CLASS() [3/3]

QT_BEGIN_NAMESPACE Q_DECLARE_JNI_CLASS ( QtInputDelegate ,
"org/qtproject/qt/android/QtInputDelegate"  )

◆ Q_DECLARE_JNI_NATIVE_METHOD() [1/2]

Q_DECLARE_JNI_NATIVE_METHOD ( dispatchGenericMotionEvent )

◆ Q_DECLARE_JNI_NATIVE_METHOD() [2/2]

Q_DECLARE_JNI_NATIVE_METHOD ( dispatchKeyEvent )

◆ Q_GLOBAL_STATIC() [1/2]

Q_GLOBAL_STATIC ( QReadWriteLock ,
g_updateMutex  )

◆ Q_GLOBAL_STATIC() [2/2]

Q_GLOBAL_STATIC ( QSemaphore ,
g_waitForServiceSetupSemaphore  )

◆ qt_androidActivity()

Q_CORE_EXPORT jobject qt_androidActivity ( )

Definition at line 335 of file qjnihelpers.cpp.

References g_jActivity.

Referenced by QAndroidPlatformNativeInterface::nativeResourceForIntegration().

+ Here is the caller graph for this function:

◆ qt_androidService()

Q_CORE_EXPORT jobject qt_androidService ( )

Definition at line 348 of file qjnihelpers.cpp.

References g_jService.

Referenced by QAndroidPlatformNativeInterface::nativeResourceForIntegration().

+ Here is the caller graph for this function:

◆ updateNativeActivity()

static jboolean updateNativeActivity ( JNIEnv * env,
jclass = nullptr )
static

Definition at line 47 of file qjnihelpers.cpp.

References g_jActivity.

Referenced by QtAndroidPrivate::initJNI().

+ Here is the caller graph for this function:

Variable Documentation

◆ g_androidDeadlockProtector

◆ g_jActivity

◆ g_javaVM

JavaVM* g_javaVM = nullptr
static

Definition at line 35 of file qjnihelpers.cpp.

Referenced by QtAndroidPrivate::initJNI(), and QtAndroidPrivate::javaVM().

◆ g_jClassLoader

jobject g_jClassLoader = nullptr
static

Definition at line 38 of file qjnihelpers.cpp.

Referenced by QtAndroidPrivate::classLoader(), and QtAndroidPrivate::initJNI().

◆ g_jService

jobject g_jService = nullptr
static

◆ g_onBindListener

Q_CONSTINIT QtAndroidPrivate::OnBindListener* g_onBindListener
static

◆ g_onBindListenerMutex

Q_CONSTINIT QBasicMutex g_onBindListenerMutex
static

◆ g_serviceSetupLockers

Q_CONSTINIT QBasicAtomicInt g_serviceSetupLockers = Q_BASIC_ATOMIC_INITIALIZER(0)
static