summaryrefslogtreecommitdiffstats
path: root/src/network/kernel
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2021-02-10 20:06:09 +0200
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2021-02-20 22:53:05 +0200
commit255459250d450286a8c5c492dab3f6d3652171c9 (patch)
treeeba80911d7e278bdd123a9733c7f75a73d6ac004 /src/network/kernel
parent4c6579eacded086ad014b0fd2432095362c1d131 (diff)
Add QAndroidApplication as a nativeInterface
QAndroidApplication provides the Android specific app context() and isActivityContext() to determine whether the context is an Activity or otherwise a Service. Task-number: QTBUG-90499 Change-Id: Iae2eef7ec44859a89825b09f52f09506b20b5420 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/network/kernel')
-rw-r--r--src/network/kernel/qnetworkproxy_android.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/network/kernel/qnetworkproxy_android.cpp b/src/network/kernel/qnetworkproxy_android.cpp
index a09593bf3c..aba4cd3ec3 100644
--- a/src/network/kernel/qnetworkproxy_android.cpp
+++ b/src/network/kernel/qnetworkproxy_android.cpp
@@ -39,9 +39,8 @@
#include "qnetworkproxy.h"
-#include <QtCore/QJniEnvironment>
-#include <QtCore/QJniObject>
-#include <QtCore/private/qjnihelpers_p.h>
+#include <QtCore/qjnienvironment.h>
+#include <QtCore/qjniobject.h>
#ifndef QT_NO_NETWORKPROXY
@@ -54,6 +53,8 @@ public:
~ProxyInfoObject();
};
+using namespace QNativeInterface;
+
Q_GLOBAL_STATIC(ProxyInfoObject, proxyInfoInstance)
static const char networkClass[] = "org/qtproject/qt/android/network/QtNetwork";
@@ -63,7 +64,7 @@ ProxyInfoObject::ProxyInfoObject()
QJniObject::callStaticMethod<void>(networkClass,
"registerReceiver",
"(Landroid/content/Context;)V",
- QtAndroidPrivate::context());
+ QAndroidApplication::context());
}
ProxyInfoObject::~ProxyInfoObject()
@@ -71,7 +72,7 @@ ProxyInfoObject::~ProxyInfoObject()
QJniObject::callStaticMethod<void>(networkClass,
"unregisterReceiver",
"(Landroid/content/Context;)V",
- QtAndroidPrivate::context());
+ QAndroidApplication::context());
}
QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query)
@@ -83,7 +84,7 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
QJniObject proxyInfo = QJniObject::callStaticObjectMethod(networkClass,
"getProxyInfo",
"(Landroid/content/Context;)Landroid/net/ProxyInfo;",
- QtAndroidPrivate::context());
+ QAndroidApplication::context());
if (proxyInfo.isValid()) {
QJniObject exclusionList = proxyInfo.callObjectMethod("getExclusionList",
"()[Ljava/lang/String;");