JNI: replace TYPE declarations with CLASS declarations
That we have two macros to declare a C++ type to represent a Java class is confusing. The TYPE macro as of now allows us to declare array types, but with QJniArray we won't need that anymore, and can just use Class[] as the type instead. Changing that will be a follow-up commit; for now, get rid of TYPE-usages to declare regular classes. Change-Id: Iea0a9548772ca701148442412cf6ad567583213f Reviewed-by: Zoltan Gera <zoltan.gera@qt.io> Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
ece7b9430d
commit
7f4cdb9941
@ -13,7 +13,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_JNI_CLASS(Environment, "android/os/Environment");
|
||||
Q_DECLARE_JNI_TYPE(File, "Ljava/io/File;");
|
||||
Q_DECLARE_JNI_CLASS(File, "java/io/File");
|
||||
|
||||
using namespace QNativeInterface;
|
||||
using namespace Qt::StringLiterals;
|
||||
|
@ -33,7 +33,7 @@ typedef _jobject* jobject;
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
Q_DECLARE_JNI_TYPE(Context, "Landroid/content/Context;")
|
||||
Q_DECLARE_JNI_CLASS(Context, "android/content/Context")
|
||||
#endif
|
||||
|
||||
namespace QNativeInterface
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_JNI_TYPE(Activity, "Landroid/app/Activity;")
|
||||
Q_DECLARE_JNI_TYPE(Service, "Landroid/app/Service;")
|
||||
Q_DECLARE_JNI_CLASS(Activity, "android/app/Activity")
|
||||
Q_DECLARE_JNI_CLASS(Service, "android/app/Service")
|
||||
|
||||
namespace QtAndroidPrivate
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ Q_GLOBAL_STATIC(ProxyInfoObject, proxyInfoInstance)
|
||||
|
||||
static const char networkClass[] = "org/qtproject/qt/android/network/QtNetwork";
|
||||
|
||||
Q_DECLARE_JNI_TYPE(ProxyInfo, "Landroid/net/ProxyInfo;")
|
||||
Q_DECLARE_JNI_CLASS(ProxyInfo, "android/net/ProxyInfo")
|
||||
Q_DECLARE_JNI_TYPE(JStringArray, "[Ljava/lang/String;")
|
||||
|
||||
ProxyInfoObject::ProxyInfoObject()
|
||||
|
@ -48,7 +48,7 @@ static void transportMediumChanged(JNIEnv *env, jobject obj, jint enumValue)
|
||||
}
|
||||
Q_DECLARE_JNI_NATIVE_METHOD(transportMediumChanged)
|
||||
|
||||
Q_DECLARE_JNI_TYPE(ConnectivityManager, "Landroid/net/ConnectivityManager;")
|
||||
Q_DECLARE_JNI_CLASS(ConnectivityManager, "android/net/ConnectivityManager")
|
||||
|
||||
AndroidConnectivityManager::AndroidConnectivityManager()
|
||||
{
|
||||
|
@ -16,11 +16,11 @@ QT_BEGIN_NAMESPACE
|
||||
using namespace QNativeInterface;
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Q_DECLARE_JNI_TYPE(ContentResolverType, "Landroid/content/ContentResolver;");
|
||||
Q_DECLARE_JNI_TYPE(UriType, "Landroid/net/Uri;");
|
||||
Q_DECLARE_JNI_CLASS(ContentResolverType, "android/content/ContentResolver");
|
||||
Q_DECLARE_JNI_CLASS(UriType, "android/net/Uri");
|
||||
Q_DECLARE_JNI_CLASS(Uri, "android/net/Uri");
|
||||
Q_DECLARE_JNI_TYPE(ParcelFileDescriptorType, "Landroid/os/ParcelFileDescriptor;");
|
||||
Q_DECLARE_JNI_TYPE(CursorType, "Landroid/database/Cursor;");
|
||||
Q_DECLARE_JNI_CLASS(ParcelFileDescriptorType, "android/os/ParcelFileDescriptor");
|
||||
Q_DECLARE_JNI_CLASS(CursorType, "android/database/Cursor");
|
||||
Q_DECLARE_JNI_TYPE(StringArray, "[Ljava/lang/String;");
|
||||
|
||||
static QJniObject &contentResolverInstance()
|
||||
|
@ -59,7 +59,7 @@ static bool m_running = false;
|
||||
Q_DECLARE_JNI_CLASS(QtNative, "org/qtproject/qt/android/QtNative")
|
||||
Q_DECLARE_JNI_CLASS(Display, "android/view/Display")
|
||||
|
||||
Q_DECLARE_JNI_TYPE(List, "Ljava/util/List;")
|
||||
Q_DECLARE_JNI_CLASS(List, "java/util/List")
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -58,7 +58,7 @@ Q_DECLARE_JNI_CLASS(Resources, "android/content/res/Resources")
|
||||
Q_DECLARE_JNI_CLASS(Size, "android/util/Size")
|
||||
Q_DECLARE_JNI_CLASS(QtNative, "org/qtproject/qt/android/QtNative")
|
||||
|
||||
Q_DECLARE_JNI_TYPE(DisplayMode, "Landroid/view/Display$Mode;")
|
||||
Q_DECLARE_JNI_CLASS(DisplayMode, "android/view/Display$Mode")
|
||||
|
||||
QAndroidPlatformScreen::QAndroidPlatformScreen(const QJniObject &displayObject)
|
||||
: QObject(), QPlatformScreen()
|
||||
|
@ -35,8 +35,8 @@ QAndroidPlatformServices::QAndroidPlatformServices()
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
Q_DECLARE_JNI_TYPE(UriType, "Landroid/net/Uri;")
|
||||
Q_DECLARE_JNI_TYPE(FileType, "Ljava/io/File;")
|
||||
Q_DECLARE_JNI_CLASS(UriType, "android/net/Uri")
|
||||
Q_DECLARE_JNI_CLASS(FileType, "java/io/File")
|
||||
Q_DECLARE_JNI_CLASS(File, "java/io/File")
|
||||
Q_DECLARE_JNI_CLASS(FileProvider, "androidx/core/content/FileProvider");
|
||||
|
||||
|
@ -41,7 +41,7 @@ static_assert(QtJniTypes::typeSignature<QtJavaWrapper>() == "Lorg/qtproject/qt/a
|
||||
static_assert(QtJniTypes::typeSignature<QtJavaWrapper>() != "Ljava/lang/Object;");
|
||||
static_assert(!(QtJniTypes::typeSignature<QtJavaWrapper>() == "X"));
|
||||
|
||||
Q_DECLARE_JNI_TYPE(JavaType, "Lorg/qtproject/qt/JavaType;");
|
||||
Q_DECLARE_JNI_CLASS(JavaType, "org/qtproject/qt/JavaType");
|
||||
static_assert(QtJniTypes::typeSignature<QtJniTypes::JavaType>() == "Lorg/qtproject/qt/JavaType;");
|
||||
Q_DECLARE_JNI_TYPE(ArrayType, "[Lorg/qtproject/qt/ArrayType;")
|
||||
static_assert(QtJniTypes::typeSignature<QtJniTypes::ArrayType>() == "[Lorg/qtproject/qt/ArrayType;");
|
||||
|
Loading…
Reference in New Issue
Block a user