aboutsummaryrefslogtreecommitdiffstats
path: root/src/jar
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2017-07-04 14:13:29 +0300
committerBogDan Vatra <bogdan@kdab.com>2017-07-26 08:02:26 +0000
commit7c38ca387cf3e9aa6d7f47a00b296247da102147 (patch)
treeee4ab281c729f561c2e85c2b6d8a72de2fe581cc /src/jar
parentda807f68d37fb3159196627904a1554405df90f6 (diff)
Say hello to low level Android Service & Binder implementations
These are the building blocks for higher level APIs such as Qt Remote Objects. [ChangeLog][Android] Added low level APIs for Android Service & Binder. Change-Id: I320214d310a398541bbde985ecf67bf6101c0b67 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/jar')
-rw-r--r--src/jar/AndroidManifest.xml6
-rw-r--r--src/jar/bundledjar.pro3
-rw-r--r--src/jar/distributedjar.pro2
-rw-r--r--src/jar/jar.pri14
-rw-r--r--src/jar/jar.pro3
-rw-r--r--src/jar/src/org/qtproject/qt5/android/extras/QtAndroidBinder.java69
-rw-r--r--src/jar/src/org/qtproject/qt5/android/extras/QtAndroidServiceConnection.java78
-rw-r--r--src/jar/src/org/qtproject/qt5/android/extras/QtNative.java55
8 files changed, 230 insertions, 0 deletions
diff --git a/src/jar/AndroidManifest.xml b/src/jar/AndroidManifest.xml
new file mode 100644
index 0000000..7eae185
--- /dev/null
+++ b/src/jar/AndroidManifest.xml
@@ -0,0 +1,6 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.qtproject.qt5.android.multimedia"
+ android:versionCode="1"
+ android:versionName="1.0" >
+ <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+</manifest>
diff --git a/src/jar/bundledjar.pro b/src/jar/bundledjar.pro
new file mode 100644
index 0000000..9456e1c
--- /dev/null
+++ b/src/jar/bundledjar.pro
@@ -0,0 +1,3 @@
+TARGET = QtAndroidExtras-bundled
+CONFIG += bundled_jar_file
+include(jar.pri)
diff --git a/src/jar/distributedjar.pro b/src/jar/distributedjar.pro
new file mode 100644
index 0000000..714916b
--- /dev/null
+++ b/src/jar/distributedjar.pro
@@ -0,0 +1,2 @@
+TARGET = QtAndroidExtras
+include(jar.pri)
diff --git a/src/jar/jar.pri b/src/jar/jar.pri
new file mode 100644
index 0000000..8ea4342
--- /dev/null
+++ b/src/jar/jar.pri
@@ -0,0 +1,14 @@
+load(qt_build_paths)
+CONFIG += java
+DESTDIR = $$MODULE_BASE_OUTDIR/jar
+
+JAVACLASSPATH += $$PWD/src
+
+JAVASOURCES += $$PWD/src/org/qtproject/qt5/android/extras/QtAndroidBinder.java \
+ $$PWD/src/org/qtproject/qt5/android/extras/QtAndroidServiceConnection.java \
+ $$PWD/src/org/qtproject/qt5/android/extras/QtNative.java
+# install
+target.path = $$[QT_INSTALL_PREFIX]/jar
+INSTALLS += target
+
+OTHER_FILES += $$JAVASOURCES
diff --git a/src/jar/jar.pro b/src/jar/jar.pro
new file mode 100644
index 0000000..6a4fcd3
--- /dev/null
+++ b/src/jar/jar.pro
@@ -0,0 +1,3 @@
+TEMPLATE=subdirs
+SUBDIRS += distributedjar.pro bundledjar.pro
+
diff --git a/src/jar/src/org/qtproject/qt5/android/extras/QtAndroidBinder.java b/src/jar/src/org/qtproject/qt5/android/extras/QtAndroidBinder.java
new file mode 100644
index 0000000..aed6652
--- /dev/null
+++ b/src/jar/src/org/qtproject/qt5/android/extras/QtAndroidBinder.java
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 BogDan Vatra <bogdan@kde.org>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Android port 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$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android.extras;
+
+import android.os.Binder;
+import android.os.Parcel;
+
+public class QtAndroidBinder extends Binder
+{
+ public QtAndroidBinder(long id)
+ {
+ m_id = id;
+ }
+
+ public void setId(long id)
+ {
+ synchronized(this)
+ {
+ m_id = id;
+ }
+ }
+ @Override
+ protected boolean onTransact(int code, Parcel data, Parcel reply, int flags)
+ {
+ synchronized(this)
+ {
+ return QtNative.onTransact(m_id, code, data, reply, flags);
+ }
+ }
+
+ private long m_id;
+}
diff --git a/src/jar/src/org/qtproject/qt5/android/extras/QtAndroidServiceConnection.java b/src/jar/src/org/qtproject/qt5/android/extras/QtAndroidServiceConnection.java
new file mode 100644
index 0000000..6b35817
--- /dev/null
+++ b/src/jar/src/org/qtproject/qt5/android/extras/QtAndroidServiceConnection.java
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 BogDan Vatra <bogdan@kde.org>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Android port 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$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android.extras;
+
+import android.content.ComponentName;
+import android.content.ServiceConnection;
+import android.os.IBinder;
+
+public class QtAndroidServiceConnection implements ServiceConnection
+{
+ public QtAndroidServiceConnection(long id)
+ {
+ m_id = id;
+ }
+
+ public void setId(long id)
+ {
+ synchronized(this)
+ {
+ m_id = id;
+ }
+ }
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service)
+ {
+ synchronized(this) {
+ QtNative.onServiceConnected(m_id, name.flattenToString(), service);
+ }
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name)
+ {
+ synchronized(this) {
+ QtNative.onServiceDisconnected(m_id, name.flattenToString());
+ }
+ }
+
+ private long m_id;
+}
diff --git a/src/jar/src/org/qtproject/qt5/android/extras/QtNative.java b/src/jar/src/org/qtproject/qt5/android/extras/QtNative.java
new file mode 100644
index 0000000..79a0592
--- /dev/null
+++ b/src/jar/src/org/qtproject/qt5/android/extras/QtNative.java
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 BogDan Vatra <bogdan@kde.org>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Android port 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$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android.extras;
+
+import android.content.ComponentName;
+import android.content.ServiceConnection;
+import android.os.IBinder;
+import android.os.Parcel;
+
+public class QtNative {
+ // Binder
+ public static native boolean onTransact(long id, int code, Parcel data, Parcel reply, int flags);
+
+
+ // ServiceConnection
+ public static native void onServiceConnected(long id, String name, IBinder service);
+ public static native void onServiceDisconnected(long id, String name);
+}