[PATCH] Template for subsurface android package
Dirk Hohndel
dirk at hohndel.org
Tue Jun 24 02:28:30 PDT 2014
Just like I asked Miika - I would prefer to get these with SOB's from your
mentor.
Andton, would you be able to do that? This way I know which patches the
mentor has reviewed and considers ready to make it into master.
/D
On Mon, Jun 23, 2014 at 11:28:52PM +0530, Venkatesh Shukla wrote:
> On Mon, Jun 23, 2014 at 8:18 PM, Venkatesh Shukla <
> venkatesh.shukla.eee11 at iitbhu.ac.in> wrote:
>
> > Hello
> >
> > For building subsurface on android, a template is needed. In this
> > template, android specific files, like AndroidManifest.xml, java files and
> > android xml files among others would be added. I am attaching a patch which
> > does takes care of this template while building for android.
> > The included manifest file contains permissions for USB usage on android
> > and device_filter.xml file to recognize the supported devices.
> >
> > --
> > Venkatesh Shukla
> >
> >
> On suggestion of Anton, I have changed the package name to
> 'org.subsurface'. Other modifications include inclusion of string.xml for
> proper naming of application and proper formatting of AndroidManifest.xml
> and setting default orientation to landscape.
>
> --
> Venkatesh Shukla
> From 251ab194b9357e58eacb2cc3ec590b037e3effab Mon Sep 17 00:00:00 2001
> From: Venkatesh Shukla <venkatesh.shukla.eee11 at iitbhu.ac.in>
> Date: Mon, 23 Jun 2014 17:18:17 +0530
> Subject: [PATCH] Template for subsurface android package
>
> For modifications to the final source code of built android package
> such as permission additions and inclusion of xml and java files, it
> is necessary to maintain a template. The template is copied without
> any modifications on top of qt android-template before building
> subsurface libraries. ( Refer: http://goo.gl/z44dQC )
>
> All android specific files would be added to android subdirectory.
>
> In this commit, permission for usage of USB devices is added to
> AndroidManifest.xml. Also included is device_filter.xml. When
> devices having VID, PID listed in this file is attached to android,
> a dialogbox is displayed asking for permission for subsurface to
> use this USB device. Accepting it would take you straight to subsurface
> application.
>
> Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11 at iitbhu.ac.in>
> ---
> .gitignore | 2 +
> android/AndroidManifest.xml | 117 ++++++++++++++++++++++++++++++++++++++
> android/res/values/strings.xml | 8 +++
> android/res/xml/device_filter.xml | 16 ++++++
> subsurface-install.pri | 2 +
> subsurface.pro | 6 ++
> 6 files changed, 151 insertions(+)
> create mode 100644 android/AndroidManifest.xml
> create mode 100644 android/res/values/strings.xml
> create mode 100644 android/res/xml/device_filter.xml
>
> diff --git a/.gitignore b/.gitignore
> index 9272286..24e8eb7 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -30,3 +30,5 @@ Makefile
> subsurface.pro.user*
> Subsurface.app
> .DS_Store
> +!android/**/*.xml
> +
> diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
> new file mode 100644
> index 0000000..4eb97e5
> --- /dev/null
> +++ b/android/AndroidManifest.xml
> @@ -0,0 +1,117 @@
> +<?xml version='1.0' encoding='utf-8'?>
> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
> + package="org.subsurface"
> + android:installLocation="auto"
> + android:versionCode="1"
> + android:versionName="1.0" >
> +
> + <application
> + android:name="org.qtproject.qt5.android.bindings.QtApplication"
> + android:hardwareAccelerated="true"
> + android:label="@string/app_name" >
> + <activity
> + android:name="org.qtproject.qt5.android.bindings.QtActivity"
> + android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
> + android:label="@string/app_name"
> + android:launchMode="singleTop"
> + android:screenOrientation="sensorLandscape" >
> + <intent-filter>
> + <action android:name="android.intent.action.MAIN" />
> +
> + <category android:name="android.intent.category.LAUNCHER" />
> + </intent-filter>
> +
> + <meta-data
> + android:name="android.app.lib_name"
> + android:value="-- %%INSERT_APP_LIB_NAME%% --" />
> + <meta-data
> + android:name="android.app.qt_sources_resource_id"
> + android:resource="@array/qt_sources" />
> + <meta-data
> + android:name="android.app.repository"
> + android:value="default" />
> + <meta-data
> + android:name="android.app.qt_libs_resource_id"
> + android:resource="@array/qt_libs" />
> + <meta-data
> + android:name="android.app.bundled_libs_resource_id"
> + android:resource="@array/bundled_libs" />
> + <!-- Deploy Qt libs as part of package -->
> + <meta-data
> + android:name="android.app.bundle_local_qt_libs"
> + android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --" />
> + <meta-data
> + android:name="android.app.bundled_in_lib_resource_id"
> + android:resource="@array/bundled_in_lib" />
> + <meta-data
> + android:name="android.app.bundled_in_assets_resource_id"
> + android:resource="@array/bundled_in_assets" />
> + <!-- Run with local libs -->
> + <meta-data
> + android:name="android.app.use_local_qt_libs"
> + android:value="-- %%USE_LOCAL_QT_LIBS%% --" />
> + <meta-data
> + android:name="android.app.libs_prefix"
> + android:value="/data/local/tmp/qt/" />
> + <meta-data
> + android:name="android.app.load_local_libs"
> + android:value="-- %%INSERT_LOCAL_LIBS%% --" />
> + <meta-data
> + android:name="android.app.load_local_jars"
> + android:value="-- %%INSERT_LOCAL_JARS%% --" />
> + <meta-data
> + android:name="android.app.static_init_classes"
> + android:value="-- %%INSERT_INIT_CLASSES%% --" />
> + <!-- Messages maps -->
> + <meta-data
> + android:name="android.app.ministro_not_found_msg"
> + android:value="@string/ministro_not_found_msg" />
> + <meta-data
> + android:name="android.app.ministro_needed_msg"
> + android:value="@string/ministro_needed_msg" />
> + <meta-data
> + android:name="android.app.fatal_error_msg"
> + android:value="@string/fatal_error_msg" />
> + <!-- Messages maps -->
> +
> +
> + <!-- Splash screen -->
> + <!--
> + <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
> + -->
> + <!-- Splash screen -->
> +
> + <intent-filter>
> + <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
> + </intent-filter>
> +
> + <meta-data
> + android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
> + android:resource="@xml/device_filter" />
> + </activity>
> + </application>
> +
> + <uses-sdk android:minSdkVersion="12" />
> +
> + <supports-screens
> + android:anyDensity="true"
> + android:largeScreens="true"
> + android:normalScreens="true"
> + android:smallScreens="true" />
> +
> + <uses-feature android:name="android.hardware.usb.host" />
> +
> + <!--
> + The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
> + Remove the comment if you do not require these default permissions.
> + -->
> + <!-- %%INSERT_PERMISSIONS -->
> +
> +
> + <!--
> + The following comment will be replaced upon deployment with default features based on the dependencies of the application.
> + Remove the comment if you do not require these default features.
> + -->
> + <!-- %%INSERT_FEATURES -->
> +
> +</manifest>
> diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
> new file mode 100644
> index 0000000..2a79f11
> --- /dev/null
> +++ b/android/res/values/strings.xml
> @@ -0,0 +1,8 @@
> +<?xml version='1.0' encoding='utf-8'?>
> +<resources>
> + <string name="app_name">Subsurface</string>
> +
> + <string name="ministro_not_found_msg">Can\'t find Ministro service.\nThe application can\'t start.</string>
> + <string name="ministro_needed_msg">This application requires Ministro service. Would you like to install it?</string>
> + <string name="fatal_error_msg">Your application encountered a fatal error and cannot continue.</string>
> +</resources>
> diff --git a/android/res/xml/device_filter.xml b/android/res/xml/device_filter.xml
> new file mode 100644
> index 0000000..822680b
> --- /dev/null
> +++ b/android/res/xml/device_filter.xml
> @@ -0,0 +1,16 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +
> +<resources>
> + <!-- FTDI Chips -->
> + <!-- (Smart Interface), Heinrichs Weikamp -->
> + <usb-device vendor-id="1027" product-id="24577"/>
> + <usb-device vendor-id="1027" product-id="24592"/>
> + <usb-device vendor-id="1027" product-id="24593"/>
> + <!-- Oceanic Custom PID -->
> + <usb-device vendor-id="1027" product-id="62560"/>
> + <!-- Suunto Custom PID -->
> + <usb-device vendor-id="1027" product-id="63104"/>
> + <!-- Cressi (Leonardo) Custom PID -->
> + <usb-device vendor-id="1027" product-id="63104"/>
> +</resources>
> +
> diff --git a/subsurface-install.pri b/subsurface-install.pri
> index db1c0ff..0fec89d 100644
> --- a/subsurface-install.pri
> +++ b/subsurface-install.pri
> @@ -130,6 +130,8 @@ mac {
> } else: android {
> # Android install rules
> QMAKE_BUNDLE_DATA += translation qttranslation
> + # Android template directory
> + ANDROID_PACKAGE_SOURCE_DIR = $$OUT_PWD/android
> } else {
> # Linux install rules
> # On Linux, we can count on packagers doing the right thing
> diff --git a/subsurface.pro b/subsurface.pro
> index 1172020..86d19cd 100644
> --- a/subsurface.pro
> +++ b/subsurface.pro
> @@ -263,6 +263,12 @@ theme.commands += $(CHK_DIR_EXISTS) $$OUT_PWD/theme || $(COPY_DIR) $$PWD/theme $
> all.depends += theme
> QMAKE_EXTRA_TARGETS += theme
>
> +android {
> + android.commands += $(CHK_DIR_EXISTS) $$OUT_PWD/android || $(COPY_DIR) $$PWD/android $$OUT_PWD
> + all.depends += android
> + QMAKE_EXTRA_TARGETS += android
> +}
> +
> DESKTOP_FILE = subsurface.desktop
> mac: ICON = packaging/macosx/Subsurface.icns
> else: ICON = subsurface-icon.svg
> --
> 1.9.3
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
More information about the subsurface
mailing list