summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2022-08-08 16:23:41 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2022-08-09 11:59:11 +0200
commitae92e4b56cc62da7d555ee3efe846ecd714e18aa (patch)
tree622f11eacfce5028190fbfd4089d52924b3ee6ae /src
parent72cfcf13c51e2b00171e8393a14fb775de718134 (diff)
QtNetwork: Modernize JNI usage
Fixes: QTBUG-104188 Change-Id: Iba14fbe23a44df6cb5f2f82b33339606165d1ce5 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/network/kernel/qnetworkproxy_android.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/network/kernel/qnetworkproxy_android.cpp b/src/network/kernel/qnetworkproxy_android.cpp
index 274a69a767..2e1fb50234 100644
--- a/src/network/kernel/qnetworkproxy_android.cpp
+++ b/src/network/kernel/qnetworkproxy_android.cpp
@@ -24,11 +24,13 @@ 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_TYPE(JStringArray, "[Ljava/lang/String;")
+
ProxyInfoObject::ProxyInfoObject()
{
QJniObject::callStaticMethod<void>(networkClass,
"registerReceiver",
- "(Landroid/content/Context;)V",
QAndroidApplication::context());
}
@@ -36,7 +38,6 @@ ProxyInfoObject::~ProxyInfoObject()
{
QJniObject::callStaticMethod<void>(networkClass,
"unregisterReceiver",
- "(Landroid/content/Context;)V",
QAndroidApplication::context());
}
@@ -46,13 +47,11 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
if (!proxyInfoInstance)
return proxyList;
- QJniObject proxyInfo = QJniObject::callStaticObjectMethod(networkClass,
- "getProxyInfo",
- "(Landroid/content/Context;)Landroid/net/ProxyInfo;",
- QAndroidApplication::context());
+ QJniObject proxyInfo = QJniObject::callStaticObjectMethod<QtJniTypes::ProxyInfo>(
+ networkClass, "getProxyInfo", QAndroidApplication::context());
if (proxyInfo.isValid()) {
- QJniObject exclusionList = proxyInfo.callObjectMethod("getExclusionList",
- "()[Ljava/lang/String;");
+ QJniObject exclusionList =
+ proxyInfo.callObjectMethod<QtJniTypes::JStringArray>("getExclusionList");
bool exclude = false;
if (exclusionList.isValid()) {
jobjectArray listObject = exclusionList.object<jobjectArray>();