aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidextras/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/androidextras/android')
-rw-r--r--src/androidextras/android/qandroidactivitycallbackresultreceiver.cpp66
-rw-r--r--src/androidextras/android/qandroidactivitycallbackresultreceiver_p.h72
-rw-r--r--src/androidextras/android/qandroidactivityresultreceiver.cpp122
-rw-r--r--src/androidextras/android/qandroidactivityresultreceiver.h65
-rw-r--r--src/androidextras/android/qandroidactivityresultreceiver_p.h78
-rw-r--r--src/androidextras/android/qandroidbinder.cpp168
-rw-r--r--src/androidextras/android/qandroidbinder.h80
-rw-r--r--src/androidextras/android/qandroidbinder_p.h77
-rw-r--r--src/androidextras/android/qandroidfunctions.cpp438
-rw-r--r--src/androidextras/android/qandroidfunctions.h118
-rw-r--r--src/androidextras/android/qandroidintent.cpp168
-rw-r--r--src/androidextras/android/qandroidintent.h70
-rw-r--r--src/androidextras/android/qandroidparcel.cpp245
-rw-r--r--src/androidextras/android/qandroidparcel.h78
-rw-r--r--src/androidextras/android/qandroidparcel_p.h78
-rw-r--r--src/androidextras/android/qandroidservice.cpp170
-rw-r--r--src/androidextras/android/qandroidservice.h81
-rw-r--r--src/androidextras/android/qandroidserviceconnection.cpp119
-rw-r--r--src/androidextras/android/qandroidserviceconnection.h66
-rw-r--r--src/androidextras/android/qjnionload.cpp111
20 files changed, 0 insertions, 2470 deletions
diff --git a/src/androidextras/android/qandroidactivitycallbackresultreceiver.cpp b/src/androidextras/android/qandroidactivitycallbackresultreceiver.cpp
deleted file mode 100644
index e32916f..0000000
--- a/src/androidextras/android/qandroidactivitycallbackresultreceiver.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidactivitycallbackresultreceiver_p.h"
-
-QAndroidActivityCallbackResultReceiver * QAndroidActivityCallbackResultReceiver::s_instance = nullptr;
-
-QAndroidActivityCallbackResultReceiver::QAndroidActivityCallbackResultReceiver()
- : QAndroidActivityResultReceiver()
- , callbackMap()
-{
-}
-
-void QAndroidActivityCallbackResultReceiver::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &intent)
-{
- callbackMap[receiverRequestCode](receiverRequestCode, resultCode, intent);
- callbackMap.remove(receiverRequestCode);
-}
-
-QAndroidActivityCallbackResultReceiver * QAndroidActivityCallbackResultReceiver::instance() {
- if (!s_instance) {
- s_instance = new QAndroidActivityCallbackResultReceiver();
- }
- return s_instance;
-}
-
-void QAndroidActivityCallbackResultReceiver::registerCallback(int receiverRequestCode, std::function<void(int, int, const QAndroidJniObject &data)> callbackFunc)
-{
- callbackMap.insert(receiverRequestCode, callbackFunc);
-}
diff --git a/src/androidextras/android/qandroidactivitycallbackresultreceiver_p.h b/src/androidextras/android/qandroidactivitycallbackresultreceiver_p.h
deleted file mode 100644
index 8232b53..0000000
--- a/src/androidextras/android/qandroidactivitycallbackresultreceiver_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDACTIVITYCALLBACKRESULTRECEIVER_P_H
-#define QANDROIDACTIVITYCALLBACKRESULTRECEIVER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QMap>
-
-#include "qandroidactivityresultreceiver.h"
-
-class QAndroidActivityCallbackResultReceiver: public QAndroidActivityResultReceiver
-{
-public:
- QAndroidActivityCallbackResultReceiver();
- void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &intent) override;
- void registerCallback(int receiverRequestCode, std::function<void(int, int, const QAndroidJniObject &)> callbackFunc);
-
- static QAndroidActivityCallbackResultReceiver *instance();
-private:
- QMap<int, std::function<void(int, int, const QAndroidJniObject &data)>> callbackMap;
-
- static QAndroidActivityCallbackResultReceiver *s_instance;
-};
-
-#endif
diff --git a/src/androidextras/android/qandroidactivityresultreceiver.cpp b/src/androidextras/android/qandroidactivityresultreceiver.cpp
deleted file mode 100644
index 2dfe509..0000000
--- a/src/androidextras/android/qandroidactivityresultreceiver.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidactivityresultreceiver.h"
-#include "qandroidactivityresultreceiver_p.h"
-#include "qandroidfunctions.h"
-#include <QtCore/private/qjnihelpers_p.h>
-#include <QtCore/qmutex.h>
-
-QT_BEGIN_NAMESPACE
-
-// Get a unique activity request code.
-static int uniqueActivityRequestCode()
-{
- static QMutex mutex;
- static int requestCode = 0x1000; // Reserve all request codes under 0x1000 for Qt.
-
- QMutexLocker locker(&mutex);
- if (requestCode == 0xf3ee) // Special case for MINISTRO_INSTALL_REQUEST_CODE
- requestCode++;
-
- if (requestCode == INT_MAX)
- qWarning("Unique activity request code has wrapped. Unexpected behavior may occur.");
-
- return requestCode++;
-}
-
-int QAndroidActivityResultReceiverPrivate::globalRequestCode(int localRequestCode) const
-{
- if (!localToGlobalRequestCode.contains(localRequestCode)) {
- int globalRequestCode = uniqueActivityRequestCode();
- localToGlobalRequestCode[localRequestCode] = globalRequestCode;
- globalToLocalRequestCode[globalRequestCode] = localRequestCode;
- }
- return localToGlobalRequestCode.value(localRequestCode);
-}
-
-bool QAndroidActivityResultReceiverPrivate::handleActivityResult(jint requestCode, jint resultCode, jobject data)
-{
- if (globalToLocalRequestCode.contains(requestCode)) {
- q->handleActivityResult(globalToLocalRequestCode.value(requestCode), resultCode, QAndroidJniObject(data));
- return true;
- }
-
- return false;
-}
-
-/*!
- \class QAndroidActivityResultReceiver
- \inmodule QtAndroidExtras
- \since 5.3
- \brief Interface used for callbacks from onActivityResult() in the main Android activity.
-
- Create a subclass of this class to be notified of the results when using the
- \c QtAndroid::startActivity() and \c QtAndroid::startIntentSender() APIs.
- */
-
-/*!
- \internal
-*/
-QAndroidActivityResultReceiver::QAndroidActivityResultReceiver()
- : d(new QAndroidActivityResultReceiverPrivate)
-{
- d->q = this;
- QtAndroidPrivate::registerActivityResultListener(d.data());
-}
-
-/*!
- \internal
-*/
-QAndroidActivityResultReceiver::~QAndroidActivityResultReceiver()
-{
- QtAndroidPrivate::unregisterActivityResultListener(d.data());
-}
-
-/*!
- \fn void QAndroidActivityResultReceiver::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data)
-
- Reimplement this function to get activity results after starting an activity using either QtAndroid::startActivity() or
- QtAndroid::startIntentSender(). The \a receiverRequestCode is the request code unique to this receiver which was originally
- passed to the startActivity() or startIntentSender() functions. The \a resultCode is the result returned by the activity,
- and \a data is either null or a Java object of the class android.content.Intent. Both the last to arguments are identical to the
- arguments passed to onActivityResult().
-*/
-
-QT_END_NAMESPACE
diff --git a/src/androidextras/android/qandroidactivityresultreceiver.h b/src/androidextras/android/qandroidactivityresultreceiver.h
deleted file mode 100644
index b71f876..0000000
--- a/src/androidextras/android/qandroidactivityresultreceiver.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDACTIVITYRESULTRECEIVER_H
-#define QANDROIDACTIVITYRESULTRECEIVER_H
-
-#include <QtAndroidExtras/qandroidextrasglobal.h>
-#include <QtAndroidExtras/qandroidjniobject.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidActivityResultReceiverPrivate;
-class Q_ANDROIDEXTRAS_EXPORT QAndroidActivityResultReceiver
-{
-public:
- QAndroidActivityResultReceiver();
- virtual ~QAndroidActivityResultReceiver();
- virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) = 0;
-
-private:
- friend class QAndroidActivityResultReceiverPrivate;
- Q_DISABLE_COPY(QAndroidActivityResultReceiver)
-
- QScopedPointer<QAndroidActivityResultReceiverPrivate> d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDACTIVITYRESULTRECEIVER_H
diff --git a/src/androidextras/android/qandroidactivityresultreceiver_p.h b/src/androidextras/android/qandroidactivityresultreceiver_p.h
deleted file mode 100644
index 21553d3..0000000
--- a/src/androidextras/android/qandroidactivityresultreceiver_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDACTIVITYRESULTRECEIVER_P_H
-#define QANDROIDACTIVITYRESULTRECEIVER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qhash.h>
-#include <QtCore/private/qjnihelpers_p.h>
-#include "qandroidactivityresultreceiver.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidActivityResultReceiverPrivate: public QtAndroidPrivate::ActivityResultListener
-{
-public:
- QAndroidActivityResultReceiver *q;
- mutable QHash<int, int> localToGlobalRequestCode;
- mutable QHash<int, int> globalToLocalRequestCode;
-
- int globalRequestCode(int localRequestCode) const;
- bool handleActivityResult(jint requestCode, jint resultCode, jobject data);
-
- static QAndroidActivityResultReceiverPrivate *get(QAndroidActivityResultReceiver *publicObject)
- {
- return publicObject->d.data();
- }
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDACTIVITYRESULTRECEIVER_P_H
diff --git a/src/androidextras/android/qandroidbinder.cpp b/src/androidextras/android/qandroidbinder.cpp
deleted file mode 100644
index e6df77c..0000000
--- a/src/androidextras/android/qandroidbinder.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidbinder.h"
-
-#include "qandroidbinder_p.h"
-#include "qandroidparcel.h"
-#include "qandroidparcel_p.h"
-
-#include <jni/qandroidjnienvironment.h>
-
-QT_BEGIN_NAMESPACE
-QAndroidBinderPrivate::QAndroidBinderPrivate(QAndroidBinder *binder)
- : handle("org/qtproject/qt/android/extras/QtAndroidBinder", "(J)V", jlong(binder))
- , m_isQtAndroidBinder(true)
-{
- QAndroidJniExceptionCleaner cleaner;
-}
-
-QAndroidBinderPrivate::QAndroidBinderPrivate(const QAndroidJniObject &binder)
- : handle(binder)
- , m_isQtAndroidBinder(false)
-{
-}
-
-QAndroidBinderPrivate::~QAndroidBinderPrivate()
-{
- if (m_isQtAndroidBinder) {
- QAndroidJniExceptionCleaner cleaner;
- handle.callMethod<void>("setId", "(J)V", jlong(0));
- if (m_deleteListener)
- m_deleteListener();
- }
-}
-
-/*!
- \class QAndroidBinder
- \inmodule QtAndroidExtras
- \brief Wraps the most important methods of Android Binder class.
-
- The QAndroidBinder is a convenience class that wraps the most important
- \l {https://developer.android.com/reference/android/os/Binder.html}{Android Binder}
- methods.
-
- \since 5.10
-*/
-
-
-/*!
- \enum QAndroidBinder::CallType
-
- This enum is used with \l QAndroidBinder::transact() to describe the mode in which the
- IPC call is performed.
-
- \value Normal normal IPC, meaning that the caller waits the result from the callee
- \value OneWay one-way IPC, meaning that the caller returns immediately, without waiting for a result from the callee
-*/
-
-/*!
- Creates a new object which can be used to perform IPC.
-
- \sa onTransact, transact
- */
-QAndroidBinder::QAndroidBinder()
- : d(new QAndroidBinderPrivate(this))
-{
-}
-
-/*!
- Creates a new object from the \a binder Java object.
-
- \sa transact
- */
-QAndroidBinder::QAndroidBinder(const QAndroidJniObject &binder)
- : d(new QAndroidBinderPrivate(binder))
-{
-}
-
-QAndroidBinder::~QAndroidBinder()
-{
-}
-
-/*!
- Default implementation is a stub that returns false.
- The user should override this method to get the transact data from the caller.
-
- The \a code is the action to perform.
- The \a data is the marshaled data sent by the caller.\br
- The \a reply is the marshaled data to be sent to the caller.\br
- The \a flags are the additional operation flags.\br
-
- \warning This method is called from Binder's thread which is different
- from the thread that this object was created.
-
- \sa transact
- */
-bool QAndroidBinder::onTransact(int /*code*/, const QAndroidParcel &/*data*/, const QAndroidParcel &/*reply*/, CallType /*flags*/)
-{
- return false;
-}
-
-/*!
- Performs an IPC call
-
- The \a code is the action to perform. Should be between
- \l {https://developer.android.com/reference/android/os/IBinder.html#FIRST_CALL_TRANSACTION}
- {FIRST_CALL_TRANSACTION} and
- \l {https://developer.android.com/reference/android/os/IBinder.html#LAST_CALL_TRANSACTION}
- {LAST_CALL_TRANSACTION}.\br
- The \a data is the marshaled data to send to the target.\br
- The \a reply (if specified) is the marshaled data to be received from the target.
- May be \b nullptr if you are not interested in the return value.\br
- The \a flags are the additional operation flags.\br
-
- \return true on success
- */
-bool QAndroidBinder::transact(int code, const QAndroidParcel &data, QAndroidParcel *reply, CallType flags) const
-{
- QAndroidJniExceptionCleaner cleaner;
- return d->handle.callMethod<jboolean>("transact", "(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z",
- jint(code), data.d->handle.object(), reply ? reply->d->handle.object() : nullptr, jint(flags));
-}
-
-/*!
- The return value is useful to call other Java API which are not covered by this wrapper
- */
-QAndroidJniObject QAndroidBinder::handle() const
-{
- return d->handle;
-}
-
-QT_END_NAMESPACE
diff --git a/src/androidextras/android/qandroidbinder.h b/src/androidextras/android/qandroidbinder.h
deleted file mode 100644
index 1e73e7d..0000000
--- a/src/androidextras/android/qandroidbinder.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDBINDER_H
-#define QANDROIDBINDER_H
-
-#include <QtAndroidExtras/qandroidextrasglobal.h>
-#include <QSharedPointer>
-
-#include <jni.h>
-
-QT_BEGIN_NAMESPACE
-class QAndroidBinderPrivate;
-class QAndroidParcel;
-class QAndroidJniObject;
-
-class Q_ANDROIDEXTRAS_EXPORT QAndroidBinder
-{
-public:
- enum class CallType {
- Normal = 0,
- OneWay = 1
- };
-
-public:
- explicit QAndroidBinder();
- QAndroidBinder(const QAndroidJniObject &binder);
-
- virtual ~QAndroidBinder();
-
- virtual bool onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, CallType flags);
- bool transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, CallType flags = CallType::Normal) const;
-
- QAndroidJniObject handle() const;
-
-private:
- friend class QAndroidBinderPrivate;
- friend class QAndroidParcelPrivate;
- friend class QAndroidServicePrivate;
- QSharedPointer<QAndroidBinderPrivate> d;
-};
-QT_END_NAMESPACE
-
-#endif // QANDROIDBINDER_H
diff --git a/src/androidextras/android/qandroidbinder_p.h b/src/androidextras/android/qandroidbinder_p.h
deleted file mode 100644
index b132b33..0000000
--- a/src/androidextras/android/qandroidbinder_p.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDBINDER_P_H
-#define QANDROIDBINDER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qandroidjniobject.h"
-
-#include <functional>
-#include <jni.h>
-
-QT_BEGIN_NAMESPACE
-class QAndroidBinder;
-class QAndroidBinderPrivate
-{
-public:
- explicit QAndroidBinderPrivate(QAndroidBinder *binder);
- explicit QAndroidBinderPrivate(const QAndroidJniObject &binder);
- void setDeleteListener(const std::function<void()> &func) { m_deleteListener = func; }
- ~QAndroidBinderPrivate();
-
-private:
- QAndroidJniObject handle;
- std::function<void()> m_deleteListener;
- bool m_isQtAndroidBinder;
- friend class QAndroidBinder;
-};
-QT_END_NAMESPACE
-
-#endif // QANDROIDBINDER_P_H
diff --git a/src/androidextras/android/qandroidfunctions.cpp b/src/androidextras/android/qandroidfunctions.cpp
deleted file mode 100644
index 8d049fc..0000000
--- a/src/androidextras/android/qandroidfunctions.cpp
+++ /dev/null
@@ -1,438 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidfunctions.h"
-#include "qandroidactivityresultreceiver.h"
-#include "qandroidactivityresultreceiver_p.h"
-#include "qandroidintent.h"
-#include "qandroidserviceconnection.h"
-#include "qandroidactivitycallbackresultreceiver_p.h"
-
-#include <QtCore/private/qjni_p.h>
-#include <QtCore/private/qjnihelpers_p.h>
-
-#include <jni/qandroidjnienvironment.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \namespace QtAndroid
- \inmodule QtAndroidExtras
- \since 5.3
- \brief The QtAndroid namespace provides miscellaneous functions to aid Android development.
- \inheaderfile QtAndroid
-*/
-
-/*!
- \since 5.10
- \enum QtAndroid::BindFlag
-
- This enum is used with QtAndroid::bindService to describe the mode in which the
- binding is performed.
-
- \value None No options.
- \value AutoCreate Automatically creates the service as long as the binding exist.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_AUTO_CREATE}
- {BIND_AUTO_CREATE} documentation for more details.
- \value DebugUnbind Include debugging help for mismatched calls to unbind.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_DEBUG_UNBIND}
- {BIND_DEBUG_UNBIND} documentation for more details.
- \value NotForeground Don't allow this binding to raise the target service's process to the foreground scheduling priority.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_NOT_FOREGROUND}
- {BIND_NOT_FOREGROUND} documentation for more details.
- \value AboveClient Indicates that the client application binding to this service considers the service to be more important than the app itself.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_ABOVE_CLIENT}
- {BIND_ABOVE_CLIENT} documentation for more details.
- \value AllowOomManagement Allow the process hosting the bound service to go through its normal memory management.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_ALLOW_OOM_MANAGEMENT}
- {BIND_ALLOW_OOM_MANAGEMENT} documentation for more details.
- \value WaivePriority Don't impact the scheduling or memory management priority of the target service's hosting process.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_WAIVE_PRIORITY}
- {BIND_WAIVE_PRIORITY} documentation for more details.
- \value Important This service is assigned a higher priority so that it is available to the client when needed.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_IMPORTANT}
- {BIND_IMPORTANT} documentation for more details.
- \value AdjustWithActivity If binding from an activity, allow the target service's process importance to be raised based on whether the activity is visible to the user.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_ADJUST_WITH_ACTIVITY}
- {BIND_ADJUST_WITH_ACTIVITY} documentation for more details.
- \value ExternalService The service being bound is an isolated, external service.
- See \l {https://developer.android.com/reference/android/content/Context.html#BIND_EXTERNAL_SERVICE}
- {BIND_EXTERNAL_SERVICE} documentation for more details.
-*/
-
-/*!
- \since 5.3
- \fn QAndroidJniObject QtAndroid::androidActivity()
-
- Returns a handle to this application's main Activity
-
- \sa QAndroidJniObject, androidService(), androidContext()
-*/
-QAndroidJniObject QtAndroid::androidActivity()
-{
- return QtAndroidPrivate::activity();
-}
-
-/*!
- \since 5.7
- \fn QAndroidJniObject QtAndroid::androidService()
-
- Returns a handle to this application's main Service
-
- \sa QAndroidJniObject, androidActivity(), androidContext()
-*/
-QAndroidJniObject QtAndroid::androidService()
-{
- return QtAndroidPrivate::service();
-}
-
-/*!
- \since 5.8
- \fn QAndroidJniObject QtAndroid::androidContext()
-
- Returns a handle to this application's main Context. Depending on the nature of
- the application the Context object is either the main Service or Activity
- object.
-
- \sa QAndroidJniObject, androidActivity(), androidService()
-*/
-QAndroidJniObject QtAndroid::androidContext()
-{
- return QtAndroidPrivate::context();
-}
-
-/*!
- \since 5.3
- \fn int QtAndroid::androidSdkVersion()
-
- Returns the Android SDK version. This is also known as the API level.
-*/
-int QtAndroid::androidSdkVersion()
-{
- return QtAndroidPrivate::androidSdkVersion();
-}
-
-/*!
- \since 5.3
-
- Starts the activity given by \a intent and provides the result asynchronously through the
- \a resultReceiver if this is non-null.
-
- If \a resultReceiver is null, then the \c startActivity() method in the \c androidActivity()
- will be called. Otherwise \c startActivityForResult() will be called.
-
- The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be
- returned along with the result, making it possible to use the same receiver for more than
- one intent.
-
- */
-void QtAndroid::startActivity(const QAndroidJniObject &intent,
- int receiverRequestCode,
- QAndroidActivityResultReceiver *resultReceiver)
-{
- QAndroidJniObject activity = androidActivity();
- if (resultReceiver != 0) {
- QAndroidActivityResultReceiverPrivate *resultReceiverD = QAndroidActivityResultReceiverPrivate::get(resultReceiver);
- activity.callMethod<void>("startActivityForResult",
- "(Landroid/content/Intent;I)V",
- intent.object<jobject>(),
- resultReceiverD->globalRequestCode(receiverRequestCode));
- } else {
- activity.callMethod<void>("startActivity",
- "(Landroid/content/Intent;)V",
- intent.object<jobject>());
- }
-}
-
-/*!
- \since 5.13
-
- Starts the activity given by \a intent and provides the result asynchronously through the
- \a resultReceiver if this is non-null.
-
- If \a resultReceiver is null, then the \c startActivity() method in the \c androidActivity()
- will be called. Otherwise \c startActivityForResult() will be called.
-
- The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be
- returned along with the result, making it possible to use the same receiver for more than
- one intent.
-
- */
-void QtAndroid::startActivity(const QAndroidIntent &intent,
- int receiverRequestCode,
- QAndroidActivityResultReceiver *resultReceiver)
-{
- startActivity(intent.handle(), receiverRequestCode, resultReceiver);
-}
-
-/*!
- \since 5.13
-
- Starts the activity given by \a intent, using the request code \a receiverRequestCode,
- and provides the result by calling \a callbackFunc.
-*/
-void QtAndroid::startActivity(const QAndroidJniObject &intent,
- int receiverRequestCode,
- std::function<void(int, int, const QAndroidJniObject &data)> callbackFunc)
-{
- QAndroidJniObject activity = androidActivity();
- QAndroidActivityCallbackResultReceiver::instance()->registerCallback(receiverRequestCode, callbackFunc);
- startActivity(intent, receiverRequestCode, QAndroidActivityCallbackResultReceiver::instance());
-}
-
-/*!
- \since 5.3
-
- Starts the activity given by \a intentSender and provides the result asynchronously through the
- \a resultReceiver if this is non-null.
-
- If \a resultReceiver is null, then the \c startIntentSender() method in the \c androidActivity()
- will be called. Otherwise \c startIntentSenderForResult() will be called.
-
- The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be
- returned along with the result, making it possible to use the same receiver for more than
- one intent.
-
-*/
-void QtAndroid::startIntentSender(const QAndroidJniObject &intentSender,
- int receiverRequestCode,
- QAndroidActivityResultReceiver *resultReceiver)
-{
- QAndroidJniObject activity = androidActivity();
- if (resultReceiver != 0) {
- QAndroidActivityResultReceiverPrivate *resultReceiverD = QAndroidActivityResultReceiverPrivate::get(resultReceiver);
- activity.callMethod<void>("startIntentSenderForResult",
- "(Landroid/content/IntentSender;ILandroid/content/Intent;III)V",
- intentSender.object<jobject>(),
- resultReceiverD->globalRequestCode(receiverRequestCode),
- 0, // fillInIntent
- 0, // flagsMask
- 0, // flagsValues
- 0); // extraFlags
- } else {
- activity.callMethod<void>("startIntentSender",
- "(Landroid/content/IntentSender;Landroid/content/Intent;III)V",
- intentSender.object<jobject>(),
- 0, // fillInIntent
- 0, // flagsMask
- 0, // flagsValues
- 0); // extraFlags
-
- }
-
-}
-
-/*!
- \typedef QtAndroid::Runnable
-
- Synonym for std::function<void()>.
-*/
-
-/*!
- \since 5.7
- \fn void QtAndroid::runOnAndroidThread(const Runnable &runnable)
-
- Posts the given \a runnable on the android thread.
- The \a runnable will be queued and executed on the Android UI thread, unless it called on the
- Android UI thread, in which case the runnable will be executed immediately.
-
- This function is useful to set asynchronously properties of objects that must be set on on Android UI thread.
-*/
-void QtAndroid::runOnAndroidThread(const QtAndroid::Runnable &runnable)
-{
- QtAndroidPrivate::runOnAndroidThread(runnable, QJNIEnvironmentPrivate());
-}
-
-/*!
- \since 5.7
- \fn void QtAndroid::runOnAndroidThreadSync(const Runnable &runnable, int timeoutMs)
-
- Posts the \a runnable on the Android UI thread and waits until the runnable is executed,
- or until \a timeoutMs has passed
-
- This function is useful to create objects, or get properties on Android UI thread:
-
- \code
- QAndroidJniObject javaControl;
- QtAndroid::runOnAndroidThreadSync([&javaControl](){
-
- // create our Java control on Android UI thread.
- javaControl = QAndroidJniObject("android/webkit/WebView",
- "(Landroid/content/Context;)V",
- QtAndroid::androidActivity().object<jobject>());
- javaControl.callMethod<void>("setWebViewClient",
- "(Landroid/webkit/WebViewClient;)V",
- QAndroidJniObject("android/webkit/WebViewClient").object());
- });
-
- // Continue the execution normally
- qDebug() << javaControl.isValid();
- \endcode
-*/
-void QtAndroid::runOnAndroidThreadSync(const QtAndroid::Runnable &runnable, int timeoutMs)
-{
- QtAndroidPrivate::runOnAndroidThreadSync(runnable, QJNIEnvironmentPrivate(), timeoutMs);
-}
-
-
-/*!
- \since 5.7
- \fn void QtAndroid::hideSplashScreen()
-
- Hides the splash screen immediately.
-*/
-void QtAndroid::hideSplashScreen()
-{
- hideSplashScreen(0);
-}
-
-/*!
- \since 5.10
- \fn void QtAndroid::hideSplashScreen(int duration)
-
- Hides the splash screen, fading it for \a duration milliseconds.
-*/
-void QtAndroid::hideSplashScreen(int duration)
-{
- QtAndroidPrivate::hideSplashScreen(QJNIEnvironmentPrivate(), duration);
-}
-
-
-/*!
- \since 5.10
- \fn bool QtAndroid::bindService(const QAndroidIntent &serviceIntent, const QAndroidServiceConnection &serviceConnection, BindFlags flags = BindFlag::None)
-
- Binds the service given by \a serviceIntent, \a serviceConnection and \a flags.
- The \a serviceIntent object identifies the service to connect to.
- The \a serviceConnection is a listener that receives the information as the service is started and stopped.
-
- \return true on success
-
- See \l {https://developer.android.com/reference/android/content/Context.html#bindService%28android.content.Intent,%20android.content.ServiceConnection,%20int%29}
- {Android documentation} documentation for more details.
-
- \sa QAndroidIntent, QAndroidServiceConnection, BindFlag
-*/
-bool QtAndroid::bindService(const QAndroidIntent &serviceIntent,
- const QAndroidServiceConnection &serviceConnection, BindFlags flags)
-{
- QAndroidJniExceptionCleaner cleaner;
- return androidContext().callMethod<jboolean>("bindService", "(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z",
- serviceIntent.handle().object(), serviceConnection.handle().object(), jint(flags));
-}
-
-static QtAndroid::PermissionResultMap privateToPublicPermissionsHash(const QtAndroidPrivate::PermissionsHash &privateHash)
-{
- QtAndroid::PermissionResultMap hash;
- for (auto it = privateHash.constBegin(); it != privateHash.constEnd(); ++it)
- hash[it.key()] = QtAndroid::PermissionResult(it.value());
- return hash;
-}
-
-/*!
- \since 5.10
- \enum QtAndroid::PermissionResult
-
- This enum is used to describe the permission status.
-
- \value Granted The permission was granted.
- \value Denied The permission was denied.
-*/
-
-/*!
- \typedef QtAndroid::PermissionResultMap
-
- Synonym for QHash<QString, PermissionResult>.
-*/
-
-/*!
- \typedef QtAndroid::PermissionResultCallback
-
- Synonym for std::function<void(const PermissionResultMap &)>.
-*/
-
-/*!
- \since 5.10
- \fn void QtAndroid::requestPermissions(const QStringList &permissions, const PermissionResultCallback &callbackFunc)
-
- Asynchronously requests \a permissions to be granted to this application, \a callbackFunc will be called with the results.
-*/
-void QtAndroid::requestPermissions(const QStringList &permissions, const QtAndroid::PermissionResultCallback &callbackFunc)
-{
- QtAndroidPrivate::requestPermissions(QJNIEnvironmentPrivate(), permissions,
- [callbackFunc](const QtAndroidPrivate::PermissionsHash &privatePerms){
- callbackFunc(privateToPublicPermissionsHash(privatePerms));
- }, false);
-}
-
-/*!
- \since 5.10
- \fn QtAndroid::PermissionResultMap QtAndroid::requestPermissionsSync(const QStringList &permissions, int timeoutMs)
-
- Synchronously requests \a permissions to be granted to this application, waits \a timeoutMs to complete.
- */
-QtAndroid::PermissionResultMap QtAndroid::requestPermissionsSync(const QStringList &permissions, int timeoutMs)
-{
- return privateToPublicPermissionsHash(QtAndroidPrivate::requestPermissionsSync(QJNIEnvironmentPrivate(), permissions, timeoutMs));
-}
-
-/*!
- \since 5.10
- \fn QtAndroid::PermissionResult QtAndroid::checkPermission(const QString &permission)
-
- Checks if the \a permission was granted or not. This function should be called every time when
- the application starts for needed permissions, as the users might disable them from Android Settings.
- */
-QtAndroid::PermissionResult QtAndroid::checkPermission(const QString &permission)
-{
- return QtAndroid::PermissionResult(QtAndroidPrivate::checkPermission(permission));
-}
-
-/*!
- \since 5.10
- \fn bool QtAndroid::shouldShowRequestPermissionRationale(const QString &permission)
-
- Returns \c true if you should show UI with a rationale for requesting a \a permission.
-*/
-bool QtAndroid::shouldShowRequestPermissionRationale(const QString &permission)
-{
- return QtAndroidPrivate::shouldShowRequestPermissionRationale(permission);
-}
-QT_END_NAMESPACE
diff --git a/src/androidextras/android/qandroidfunctions.h b/src/androidextras/android/qandroidfunctions.h
deleted file mode 100644
index 0433d21..0000000
--- a/src/androidextras/android/qandroidfunctions.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDFUNCTIONS_H
-#define QANDROIDFUNCTIONS_H
-
-#if 0
-#pragma qt_class(QtAndroid)
-#endif
-
-#include <QtAndroidExtras/qandroidextrasglobal.h>
-#include <QtAndroidExtras/qandroidjniobject.h>
-
-#include <functional>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidActivityResultReceiver;
-class QAndroidServiceConnection;
-class QAndroidIntent;
-
-namespace QtAndroid
-{
- Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject androidActivity();
- Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject androidService();
- Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject androidContext();
- Q_ANDROIDEXTRAS_EXPORT int androidSdkVersion();
-
- Q_ANDROIDEXTRAS_EXPORT void startIntentSender(const QAndroidJniObject &intentSender,
- int receiverRequestCode,
- QAndroidActivityResultReceiver *resultReceiver = nullptr);
- Q_ANDROIDEXTRAS_EXPORT void startActivity(const QAndroidJniObject &intent,
- int receiverRequestCode,
- QAndroidActivityResultReceiver *resultReceiver = nullptr);
- Q_ANDROIDEXTRAS_EXPORT void startActivity(const QAndroidIntent &intent,
- int receiverRequestCode,
- QAndroidActivityResultReceiver *resultReceiver = nullptr);
- Q_ANDROIDEXTRAS_EXPORT void startActivity(const QAndroidJniObject &intent,
- int receiverRequestCode,
- std::function<void(int, int, const QAndroidJniObject &data)> callbackFunc);
-
- enum class BindFlag {
- None = 0x00000000,
- AutoCreate = 0x00000001,
- DebugUnbind = 0x00000002,
- NotForeground = 0x00000004,
- AboveClient = 0x00000008,
- AllowOomManagement = 0x00000010,
- WaivePriority = 0x00000020,
- Important = 0x00000040,
- AdjustWithActivity = 0x00000080,
- ExternalService = -2147483648 // 0x80000000
-
- };
- Q_DECLARE_FLAGS(BindFlags, BindFlag)
-
- Q_ANDROIDEXTRAS_EXPORT bool bindService(const QAndroidIntent &serviceIntent,
- const QAndroidServiceConnection &serviceConnection,
- BindFlags flags = BindFlag::None);
-
- typedef std::function<void()> Runnable;
- Q_ANDROIDEXTRAS_EXPORT void runOnAndroidThread(const Runnable &runnable);
- Q_ANDROIDEXTRAS_EXPORT void runOnAndroidThreadSync(const Runnable &runnable, int timeoutMs = INT_MAX);
-
- Q_ANDROIDEXTRAS_EXPORT void hideSplashScreen(); // ### Qt6: merge with next overload
- Q_ANDROIDEXTRAS_EXPORT void hideSplashScreen(int duration);
-
- enum class PermissionResult {
- Denied = -1,
- Granted = 0
- };
- typedef QHash<QString, PermissionResult> PermissionResultMap;
- typedef std::function<void(const PermissionResultMap &)> PermissionResultCallback;
- Q_ANDROIDEXTRAS_EXPORT void requestPermissions(const QStringList &permissions, const PermissionResultCallback &callbackFunc);
- Q_ANDROIDEXTRAS_EXPORT PermissionResultMap requestPermissionsSync(const QStringList &permissions, int timeoutMs = INT_MAX);
- Q_ANDROIDEXTRAS_EXPORT PermissionResult checkPermission(const QString &permission);
- Q_ANDROIDEXTRAS_EXPORT bool shouldShowRequestPermissionRationale(const QString &permission);
-}
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDFUNCTIONS_H
diff --git a/src/androidextras/android/qandroidintent.cpp b/src/androidextras/android/qandroidintent.cpp
deleted file mode 100644
index 9c0fecb..0000000
--- a/src/androidextras/android/qandroidintent.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidintent.h"
-
-#include <jni/qandroidjnienvironment.h>
-#include <QtCore/private/qjni_p.h>
-#include <QBuffer>
-#include <QDataStream>
-#include <QVariant>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAndroidIntent
- \inmodule QtAndroidExtras
- \brief Wraps the most important methods of Android Intent class.
-
- The QAndroidIntent is a convenience class that wraps the most important
- \l {https://developer.android.com/reference/android/content/Intent.html}{Android Intent}
- methods.
-
- \since 5.10
-*/
-
-/*!
- Create a new intent
- */
-QAndroidIntent::QAndroidIntent()
- : m_handle("android.content.Intent", "()V")
-{
-
-}
-
-QAndroidIntent::~QAndroidIntent()
-{}
-
-/*!
- Wraps the provided \a intent java object.
- */
-QAndroidIntent::QAndroidIntent(const QAndroidJniObject &intent)
- : m_handle(intent)
-{
-}
-
-/*!
- Creates a new intent and sets the provided \a action.
- */
-QAndroidIntent::QAndroidIntent(const QString &action)
- : m_handle("android.content.Intent", "(Ljava/lang/String;)V",
- QAndroidJniObject::fromString(action).object())
-{
- QAndroidJniExceptionCleaner cleaner;
-}
-
-/*!
- Creates a new intent and sets the provided \a packageContext and the service \a className.
- Example:
- \code
- auto serviceIntent = QAndroidIntent(QtAndroid::androidActivity().object(), "com.example.MyService");
- \endcode
-
- \sa QtAndroid::androidActivity, QtAndroid::bindService
- */
-QAndroidIntent::QAndroidIntent(const QAndroidJniObject &packageContext, const char *className)
- : m_handle("android/content/Intent", "(Landroid/content/Context;Ljava/lang/Class;)V",
- packageContext.object(), QJNIEnvironmentPrivate::findClass(className))
-{
- QAndroidJniExceptionCleaner cleaner;
-}
-
-/*!
- Sets the \a key with the \a data in the Intent extras
- */
-void QAndroidIntent::putExtra(const QString &key, const QByteArray &data)
-{
- QAndroidJniExceptionCleaner cleaner;
- QAndroidJniEnvironment env;
- jbyteArray array = env->NewByteArray(data.size());
- env->SetByteArrayRegion(array, 0, data.length(), reinterpret_cast<const jbyte*>(data.constData()));
- m_handle.callObjectMethod("putExtra", "(Ljava/lang/String;[B)Landroid/content/Intent;",
- QAndroidJniObject::fromString(key).object(), array);
- env->DeleteLocalRef(array);
-}
-
-/*!
- Returns the extra \a key data from the Intent extras
- */
-QByteArray QAndroidIntent::extraBytes(const QString &key)
-{
- QAndroidJniExceptionCleaner cleaner;
- auto array = m_handle.callObjectMethod("getByteArrayExtra", "(Ljava/lang/String;)[B",
- QAndroidJniObject::fromString(key).object());
- if (!array.isValid() || !array.object())
- return QByteArray();
- QAndroidJniEnvironment env;
- auto sz = env->GetArrayLength(jarray(array.object()));
- QByteArray res(sz, Qt::Initialization::Uninitialized);
- env->GetByteArrayRegion(jbyteArray(array.object()), 0, sz, reinterpret_cast<jbyte *>(res.data()));
- return res;
-}
-
-/*!
- Sets the \a key with the \a value in the Intent extras.
- */
-void QAndroidIntent::putExtra(const QString &key, const QVariant &value)
-{
- QByteArray buff;
- QDataStream stream(&buff, QIODevice::WriteOnly);
- stream << value;
- putExtra(key, buff);
-}
-
-/*!
- Returns the extra \a key data from the Intent extras as a QVariant
- */
-QVariant QAndroidIntent::extraVariant(const QString &key)
-{
- QDataStream stream(extraBytes(key));
- QVariant res;
- stream >> res;
- return res;
-}
-
-/*!
- The return value is useful to call other Java API which are not covered by this wrapper
- */
-QAndroidJniObject QAndroidIntent::handle() const
-{
- return m_handle;
-}
-QT_END_NAMESPACE
diff --git a/src/androidextras/android/qandroidintent.h b/src/androidextras/android/qandroidintent.h
deleted file mode 100644
index 3da5692..0000000
--- a/src/androidextras/android/qandroidintent.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDINTENT_H
-#define QANDROIDINTENT_H
-
-#include <QtAndroidExtras/qandroidextrasglobal.h>
-#include <QtAndroidExtras/qandroidjniobject.h>
-
-QT_BEGIN_NAMESPACE
-class QAndroidJniObject;
-class Q_ANDROIDEXTRAS_EXPORT QAndroidIntent
-{
-public:
- QAndroidIntent();
- virtual ~QAndroidIntent();
- explicit QAndroidIntent(const QAndroidJniObject &intent);
- explicit QAndroidIntent(const QString &action);
- explicit QAndroidIntent(const QAndroidJniObject &packageContext, const char *className);
-
- void putExtra(const QString &key, const QByteArray &data);
- QByteArray extraBytes(const QString &key);
-
- void putExtra(const QString &key, const QVariant &value);
- QVariant extraVariant(const QString &key);
-
- QAndroidJniObject handle() const;
-
-private:
- QAndroidJniObject m_handle;
-};
-QT_END_NAMESPACE
-
-#endif // QANDROIDINTENT_H
diff --git a/src/androidextras/android/qandroidparcel.cpp b/src/androidextras/android/qandroidparcel.cpp
deleted file mode 100644
index 6923f87..0000000
--- a/src/androidextras/android/qandroidparcel.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidparcel.h"
-
-#include "qandroidbinder.h"
-#include "qandroidbinder_p.h"
-#include "qandroidparcel_p.h"
-
-#include <QAndroidJniObject>
-#include <QAndroidJniEnvironment>
-#include <QBuffer>
-#include <QDataStream>
-#include <QVariant>
-
-QT_BEGIN_NAMESPACE
-
-struct FileDescriptor
-{
- explicit FileDescriptor(int fd = -1)
- : handle("java/io/FileDescriptor")
- {
- QAndroidJniExceptionCleaner cleaner;
- setFileDescriptor(fd);
- }
-
- inline void setFileDescriptor(int fd)
- {
- QAndroidJniExceptionCleaner cleaner;
- handle.setField("descriptor", fd);
- }
-
- QAndroidJniObject handle;
-};
-
-QAndroidParcelPrivate::QAndroidParcelPrivate()
- : handle(QAndroidJniObject::callStaticObjectMethod("android/os/Parcel","obtain", "()Landroid/os/Parcel;").object())
-{}
-
-QAndroidParcelPrivate::QAndroidParcelPrivate(const QAndroidJniObject &parcel)
- : handle(parcel)
-{}
-
-void QAndroidParcelPrivate::writeData(const QByteArray &data) const
-{
- if (data.isEmpty())
- return;
-
- QAndroidJniExceptionCleaner cleaner;
- QAndroidJniEnvironment env;
- jbyteArray array = env->NewByteArray(data.size());
- env->SetByteArrayRegion(array, 0, data.length(), reinterpret_cast<const jbyte*>(data.constData()));
- handle.callMethod<void>("writeByteArray", "([B)V", array);
- env->DeleteLocalRef(array);
-}
-
-void QAndroidParcelPrivate::writeBinder(const QAndroidBinder &binder) const
-{
- QAndroidJniExceptionCleaner cleaner;
- handle.callMethod<void>("writeStrongBinder", "(Landroid/os/IBinder;)V", binder.handle().object());
-}
-
-void QAndroidParcelPrivate::writeFileDescriptor(int fd) const
-{
- QAndroidJniExceptionCleaner cleaner;
- handle.callMethod<void>("writeFileDescriptor", "(Ljava/io/FileDescriptor;)V", FileDescriptor(fd).handle.object());
-}
-
-QByteArray QAndroidParcelPrivate::readData() const
-{
- QAndroidJniExceptionCleaner cleaner;
- auto array = handle.callObjectMethod("createByteArray", "()[B");
- QAndroidJniEnvironment env;
- auto sz = env->GetArrayLength(jbyteArray(array.object()));
- QByteArray res(sz, Qt::Initialization::Uninitialized);
- env->GetByteArrayRegion(jbyteArray(array.object()), 0, sz, reinterpret_cast<jbyte *>(res.data()));
- return res;
-}
-
-int QAndroidParcelPrivate::readFileDescriptor() const
-{
- QAndroidJniExceptionCleaner cleaner;
- auto parcelFD = handle.callObjectMethod("readFileDescriptor", "()Landroid/os/ParcelFileDescriptor;");
- if (parcelFD.isValid())
- return parcelFD.callMethod<jint>("getFd", "()I");
- return -1;
-}
-
-QAndroidBinder QAndroidParcelPrivate::readBinder() const
-{
- QAndroidJniExceptionCleaner cleaner;
- auto strongBinder = handle.callObjectMethod("readStrongBinder", "()Landroid/os/IBinder;");
- return QAndroidBinder(strongBinder.object());
-}
-
-/*!
- \class QAndroidParcel
- \inmodule QtAndroidExtras
- \brief Wraps the most important methods of Android Parcel class.
-
- The QAndroidParcel is a convenience class that wraps the most important
- \l {https://developer.android.com/reference/android/os/Parcel.html}{Android Parcel}
- methods.
-
- \since 5.10
-*/
-
-/*!
- Creates a new object.
- */
-QAndroidParcel::QAndroidParcel()
- : d(new QAndroidParcelPrivate())
-{
-}
-
-/*!
- Wraps the \a parcel object.
- */
-QAndroidParcel::QAndroidParcel(const QAndroidJniObject& parcel)
- : d(new QAndroidParcelPrivate(parcel))
-{
-
-}
-
-QAndroidParcel::~QAndroidParcel()
-{
-}
-
-/*!
- Writes the provided \a data as a byte array
- */
-void QAndroidParcel::writeData(const QByteArray &data) const
-{
- d->writeData(data);
-}
-
-/*!
- Writes the provided \a value. The value is converted into a
- QByteArray before is written.
- */
-void QAndroidParcel::writeVariant(const QVariant &value) const
-{
- QByteArray buff;
- QDataStream stream(&buff, QIODevice::WriteOnly);
- stream << value;
- d->writeData(buff);
-}
-
-/*!
- Writes a \a binder object. This is useful for a client to
- send to a server a binder which can be used by the server callback the client.
- */
-void QAndroidParcel::writeBinder(const QAndroidBinder &binder) const
-{
- d->writeBinder(binder);
-}
-
-/*!
- Writes the provided \a fd.
- */
-void QAndroidParcel::writeFileDescriptor(int fd) const
-{
- d->writeFileDescriptor(fd);
-}
-
-/*!
- Returns the data as a QByteArray
- */
-QByteArray QAndroidParcel::readData() const
-{
- return d->readData();
-}
-
-/*!
- Returns the data as a QVariant
- */
-QVariant QAndroidParcel::readVariant() const
-{
- QDataStream stream(d->readData());
- QVariant res;
- stream >> res;
- return res;
-}
-
-/*!
- Returns the binder as a QAndroidBinder
- */
-QAndroidBinder QAndroidParcel::readBinder() const
-{
- return d->readBinder();
-}
-
-/*!
- Returns the file descriptor
- */
-int QAndroidParcel::readFileDescriptor() const
-{
- return d->readFileDescriptor();
-}
-
-/*!
- The return value is useful to call other Java API which are not covered by this wrapper
- */
-QAndroidJniObject QAndroidParcel::handle() const
-{
- return d->handle;
-}
-
-QT_END_NAMESPACE
diff --git a/src/androidextras/android/qandroidparcel.h b/src/androidextras/android/qandroidparcel.h
deleted file mode 100644
index 23d1edc..0000000
--- a/src/androidextras/android/qandroidparcel.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPARCEL_H
-#define QANDROIDPARCEL_H
-
-#include <QtAndroidExtras/qandroidextrasglobal.h>
-#include <QSharedPointer>
-#include <QVariant>
-
-QT_BEGIN_NAMESPACE
-class QAndroidBinder;
-class QAndroidJniObject;
-class QAndroidParcelPrivate;
-class Q_ANDROIDEXTRAS_EXPORT QAndroidParcel
-{
-public:
- QAndroidParcel();
- explicit QAndroidParcel(const QAndroidJniObject& parcel);
- virtual ~QAndroidParcel();
-
- void writeData(const QByteArray &data) const;
- void writeVariant(const QVariant &value) const;
- void writeBinder(const QAndroidBinder &binder) const;
- void writeFileDescriptor(int fd) const;
-
- QByteArray readData() const;
- QVariant readVariant() const;
- QAndroidBinder readBinder() const;
- int readFileDescriptor() const;
-
- QAndroidJniObject handle() const;
-
-private:
- friend class QAndroidParcelPrivate;
- friend class QAndroidBinder;
- QSharedPointer<QAndroidParcelPrivate> d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDPARCEL_H
diff --git a/src/androidextras/android/qandroidparcel_p.h b/src/androidextras/android/qandroidparcel_p.h
deleted file mode 100644
index 0be55f8..0000000
--- a/src/androidextras/android/qandroidparcel_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPARCEL_P_H
-#define QANDROIDPARCEL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QAndroidJniObject>
-QT_BEGIN_NAMESPACE
-class QAndroidBinder;
-class QAndroidParcelPrivate
-{
-public:
- QAndroidParcelPrivate();
- explicit QAndroidParcelPrivate(const QAndroidJniObject& parcel);
-
- void writeData(const QByteArray &data) const;
- void writeBinder(const QAndroidBinder &binder) const;
- void writeFileDescriptor(int fd) const;
-
- QByteArray readData() const;
- int readFileDescriptor() const;
- QAndroidBinder readBinder() const;
-
-private:
- friend class QAndroidBinder;
- friend class QAndroidParcel;
- QAndroidJniObject handle;
-};
-QT_END_NAMESPACE
-
-#endif // QANDROIDPARCEL_P_H
diff --git a/src/androidextras/android/qandroidservice.cpp b/src/androidextras/android/qandroidservice.cpp
deleted file mode 100644
index 331f04a..0000000
--- a/src/androidextras/android/qandroidservice.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidservice.h"
-
-#include "qandroidintent.h"
-#include "qandroidbinder.h"
-#include "qandroidbinder_p.h"
-
-#include <private/qjnihelpers_p.h>
-
-#include <QMutex>
-#include <QTimer>
-#include <QSet>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidServicePrivate : public QObject, public QtAndroidPrivate::OnBindListener
-{
-public:
- QAndroidServicePrivate(QAndroidService *service, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder = {})
- : m_service(service)
- , m_binder(binder)
- {
- QTimer::singleShot(0,this, [this]{ QtAndroidPrivate::setOnBindListener(this);});
- }
-
- ~QAndroidServicePrivate()
- {
- QMutexLocker lock(&m_bindersMutex);
- while (!m_binders.empty()) {
- auto it = m_binders.begin();
- lock.unlock();
- delete (*it);
- lock.relock();
- }
- }
-
- // OnBindListener interface
- jobject onBind(jobject intent) override
- {
- auto qai = QAndroidIntent(intent);
- auto binder = m_binder ? m_binder(qai) : m_service->onBind(qai);
- if (binder) {
- {
- QMutexLocker lock(&m_bindersMutex);
- binder->d->setDeleteListener([this, binder]{binderDestroied(binder);});
- m_binders.insert(binder);
- }
- return binder->handle().object();
- }
- return nullptr;
- }
-
-private:
- void binderDestroied(QAndroidBinder* obj)
- {
- QMutexLocker lock(&m_bindersMutex);
- m_binders.remove(obj);
- }
-
-public:
- QAndroidService *m_service = nullptr;
- std::function<QAndroidBinder *(const QAndroidIntent &)> m_binder;
- QMutex m_bindersMutex;
- QSet<QAndroidBinder*> m_binders;
-};
-
-/*!
- \class QAndroidService
- \inmodule QtAndroidExtras
- \brief Wraps the most important methods of Android Service class.
-
- The QAndroidService is a convenience class that wraps the most important
- \l {https://developer.android.com/reference/android/app/Service.html}{Android Service}
- methods.
-
- \since 5.10
-*/
-
-
-/*!
- \fn QAndroidService::QAndroidService(int &argc, char **argv)
-
- Creates a new Android service, passing \a argc and \a argv as parameters.
-
- //! Parameter \a flags is omitted in the documentation.
-
- \sa QCoreApplication
- */
-QAndroidService::QAndroidService(int &argc, char **argv, int flags)
- : QCoreApplication (argc, argv, QtAndroidPrivate::acuqireServiceSetup(flags))
- , d(new QAndroidServicePrivate{this})
-{
-}
-
-/*!
- \fn QAndroidService::QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder)
-
- Creates a new Android service, passing \a argc and \a argv as parameters.
-
- \a binder is used to create a \l {QAndroidBinder}{binder} when needed.
-
- //! Parameter \a flags is omitted in the documentation.
-
- \sa QCoreApplication
- */
-QAndroidService::QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder, int flags)
- : QCoreApplication (argc, argv, QtAndroidPrivate::acuqireServiceSetup(flags))
- , d(new QAndroidServicePrivate{this, binder})
-{
-}
-
-QAndroidService::~QAndroidService()
-{}
-
-/*!
- The user must override this method and to return a binder.
-
- The \a intent parameter contains all the caller information.
-
- The returned binder is used by the caller to perform IPC calls.
-
- \warning This method is called from Binder's thread which is different
- from the thread that this object was created.
-
- \sa QAndroidBinder::onTransact, QAndroidBinder::transact
- */
-QAndroidBinder* QAndroidService::onBind(const QAndroidIntent &/*intent*/)
-{
- return nullptr;
-}
-
-QT_END_NAMESPACE
diff --git a/src/androidextras/android/qandroidservice.h b/src/androidextras/android/qandroidservice.h
deleted file mode 100644
index b9acd18..0000000
--- a/src/androidextras/android/qandroidservice.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDSERVICE_H
-#define QANDROIDSERVICE_H
-
-#include <QtAndroidExtras/qandroidextrasglobal.h>
-#include <QCoreApplication>
-#include <QSharedPointer>
-#include <functional>
-
-QT_BEGIN_NAMESPACE
-class QAndroidServicePrivate;
-class QAndroidIntent;
-class QAndroidBinder;
-class Q_ANDROIDEXTRAS_EXPORT QAndroidService : public QCoreApplication
-{
- Q_OBJECT
-
-public:
- QAndroidService(int &argc, char **argv
-#ifndef Q_QDOC
- , int flags = ApplicationFlags
-#endif
- );
- QAndroidService(int &argc, char **argv,
- const std::function<QAndroidBinder*(const QAndroidIntent &intent)> & binder
-#ifndef Q_QDOC
- , int flags = ApplicationFlags
-#endif
- );
- virtual ~QAndroidService();
-
- virtual QAndroidBinder* onBind(const QAndroidIntent &intent);
-
-private:
- friend class QAndroidServicePrivate;
- Q_DISABLE_COPY(QAndroidService)
-
- QScopedPointer<QAndroidServicePrivate> d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDSERVICE_H
diff --git a/src/androidextras/android/qandroidserviceconnection.cpp b/src/androidextras/android/qandroidserviceconnection.cpp
deleted file mode 100644
index 3daf1cc..0000000
--- a/src/androidextras/android/qandroidserviceconnection.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidserviceconnection.h"
-#include "qandroidjniobject.h"
-
-#include <QAndroidJniEnvironment>
-
-QT_BEGIN_NAMESPACE
-/*!
- \class QAndroidServiceConnection
- \inmodule QtAndroidExtras
- \brief Wraps the most important methods of Android ServiceConnection class.
-
- The QAndroidServiceConnection is a convenience abstract class which wraps the
- \l {https://developer.android.com/reference/android/content/ServiceConnection.html}{Android ServiceConnection}
- interface.
-
- It is useful when you perform a QtAndroid::bindService operation.
-
- \since 5.10
-*/
-
-
-/*!
- Creates a new object
- */
-QAndroidServiceConnection::QAndroidServiceConnection()
- : m_handle("org/qtproject/qt/android/extras/QtAndroidServiceConnection", "(J)V", jlong(this))
-{
-}
-
-/*!
- Creates a new object from an existing \a serviceConnection.
-
- It's useful when you have your own Java implementation.
- Of course onServiceConnected()/onServiceDisconnected()
- will not be called anymore.
- */
-QAndroidServiceConnection::QAndroidServiceConnection(const QAndroidJniObject &serviceConnection)
- : m_handle(serviceConnection)
-{
-}
-
-QAndroidServiceConnection::~QAndroidServiceConnection()
-{
- m_handle.callMethod<void>("setId", "(J)V", jlong(this));
-}
-
-/*!
- returns the underline QAndroidJniObject
- */
-QAndroidJniObject QAndroidServiceConnection::handle() const
-{
- return m_handle;
-}
-
-/*!
- \fn void QAndroidServiceConnection::onServiceConnected(const QString &name, const QAndroidBinder &serviceBinder)
-
- This notification is called when the client managed to connect to the service.
- The \a name contains the server name, the \a serviceBinder is the binder that the client
- uses to perform IPC operations.
-
- \warning This method is called from Binder's thread which is different
- from the thread that this object was created.
-
- returns the underline QAndroidJniObject
- */
-
-/*!
- \fn void QAndroidServiceConnection::onServiceDisconnected(const QString &name)
-
- Called when a connection to the Service has been lost.
- The \a name parameter specifies which connectioen was lost.
-
- \warning This method is called from Binder's thread which is different
- from the thread that this object was created.
-
- returns the underline QAndroidJniObject
- */
-
-QT_END_NAMESPACE
diff --git a/src/androidextras/android/qandroidserviceconnection.h b/src/androidextras/android/qandroidserviceconnection.h
deleted file mode 100644
index a46c7bb..0000000
--- a/src/androidextras/android/qandroidserviceconnection.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTANDROIDSERVICECONNECTION_H
-#define QTANDROIDSERVICECONNECTION_H
-
-#include <QtAndroidExtras/qandroidextrasglobal.h>
-#include <QtAndroidExtras/QAndroidJniObject>
-
-QT_BEGIN_NAMESPACE
-class QAndroidBinder;
-class Q_ANDROIDEXTRAS_EXPORT QAndroidServiceConnection
-{
-public:
- QAndroidServiceConnection();
- explicit QAndroidServiceConnection(const QAndroidJniObject &serviceConnection);
- virtual ~QAndroidServiceConnection();
-
- virtual void onServiceConnected(const QString &name, const QAndroidBinder &serviceBinder) = 0;
- virtual void onServiceDisconnected(const QString &name) = 0;
-
- QAndroidJniObject handle() const;
-private:
- Q_DISABLE_COPY(QAndroidServiceConnection)
- QAndroidJniObject m_handle;
-};
-
-QT_END_NAMESPACE
-
-#endif // QTANDROIDSERVICECONNECTION_H
diff --git a/src/androidextras/android/qjnionload.cpp b/src/androidextras/android/qjnionload.cpp
deleted file mode 100644
index 3a7ccc2..0000000
--- a/src/androidextras/android/qjnionload.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 BogDan Vatra <[email protected]>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidbinder.h"
-#include "qandroidparcel.h"
-#include "qandroidserviceconnection.h"
-
-#include <android/log.h>
-#include <QAndroidJniObject>
-#include <jni.h>
-
-static jboolean onTransact(JNIEnv */*env*/, jclass /*cls*/, jlong id, jint code, jobject data, jobject reply, jint flags)
-{
- if (!id)
- return false;
- return reinterpret_cast<QAndroidBinder*>(id)->onTransact(code, QAndroidParcel(data), QAndroidParcel(reply), QAndroidBinder::CallType(flags));
-}
-
-static void onServiceConnected(JNIEnv */*env*/, jclass /*cls*/, jlong id, jstring name, jobject service)
-{
- if (!id)
- return;
- return reinterpret_cast<QAndroidServiceConnection *>(id)->onServiceConnected(QAndroidJniObject(name).toString(),
- QAndroidBinder(service));
-}
-
-static void onServiceDisconnected(JNIEnv */*env*/, jclass /*cls*/, jlong id, jstring name)
-{
- if (!id)
- return;
- return reinterpret_cast<QAndroidServiceConnection *>(id)->onServiceDisconnected(QAndroidJniObject(name).toString());
-}
-
-static JNINativeMethod methods[] = {
- {"onTransact", "(JILandroid/os/Parcel;Landroid/os/Parcel;I)Z", (void *)onTransact},
- {"onServiceConnected", "(JLjava/lang/String;Landroid/os/IBinder;)V", (void *)onServiceConnected},
- {"onServiceDisconnected", "(JLjava/lang/String;)V", (void *)onServiceDisconnected}
-};
-
-
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
-{
- static bool initialized = false;
- if (initialized)
- return JNI_VERSION_1_6;
- initialized = true;
-
- typedef union {
- JNIEnv *nativeEnvironment;
- void *venv;
- } UnionJNIEnvToVoid;
-
- UnionJNIEnvToVoid uenv;
- uenv.venv = nullptr;
-
- if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) {
- __android_log_print(ANDROID_LOG_FATAL, "Qt", "GetEnv failed");
- return -1;
- }
-
- JNIEnv *env = uenv.nativeEnvironment;
- jclass clazz;
- clazz = env->FindClass("org/qtproject/qt/android/extras/QtNative");
- if (!clazz) {
- __android_log_print(ANDROID_LOG_FATAL,"Qt", "Can't find \"org/qtproject/qt/android/extras/QtNative\" class");
- return -1;
- }
-
- if (env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
- __android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed");
- return -1;
- }
-
- return JNI_VERSION_1_6;
-}