diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-04-26 13:19:46 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-05-17 00:34:06 +0200 |
commit | 367092d7e02bfe0054b78e856b7addbdb56aae2e (patch) | |
tree | f17793c691da879973689d9cab355ea3f2f1e4e1 /src/corelib/platform | |
parent | f6e89e901ba718d64b50f79f3b1b327a7f6a0211 (diff) |
Return specific types for frequently used Java objects
This allows us to specialize JNI type signature templates for e.g. the
context object, which in Java signatures is "android/content/Context".
Introduce a Q_DECLARE_JNI_TYPE macro that takes care of the plumbing.
The types declared this way live in the QtJniTypes namespace, and
transparently convert from and to jobject. Since jobject is a typedef
to _jobject* we cannot create a subclass. Use a "Object" superclass
that we can provide a QJniObject constructor for so that we don't
require the QJniObject declaration to be able to use the macro.
The APIs in the QNativeInterface namespace doesn't provide source or
binary compatibility guarantees, so we can change the return types.
Change-Id: I4cf9fa734ec9a5550b6fddeb14ef0ffd72663f29
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/corelib/platform')
-rw-r--r-- | src/corelib/platform/android/qandroidnativeinterface.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/platform/android/qandroidnativeinterface.cpp b/src/corelib/platform/android/qandroidnativeinterface.cpp index 09c24df410..a93844139b 100644 --- a/src/corelib/platform/android/qandroidnativeinterface.cpp +++ b/src/corelib/platform/android/qandroidnativeinterface.cpp @@ -38,14 +38,14 @@ static QBasicMutex g_pendingRunnablesMutex; QT_DEFINE_NATIVE_INTERFACE(QAndroidApplication); /*! - \fn jobject QNativeInterface::QAndroidApplication::context() + \fn jobject QNativeInterface::QAndroidApplication::context() Returns the Android context as a \c jobject. The context is an \c Activity if the main activity object is valid. Otherwise, the context is a \c Service. \since 6.2 */ -jobject QNativeInterface::QAndroidApplication::context() +QtJniTypes::Context QNativeInterface::QAndroidApplication::context() { return QtAndroidPrivate::context(); } |