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
From c59907d4b3040fcc50e9bdb174254179aeb56665 Mon Sep 17 00:00:00 2001 From: Venkatesh Shukla <[email protected]> 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 <[email protected]> --- .gitignore | 2 ++ android/AndroidManifest.xml | 62 +++++++++++++++++++++++++++++++++++++++ android/res/xml/device_filter.xml | 16 ++++++++++ subsurface-install.pri | 2 ++ subsurface.pro | 6 ++++ 5 files changed, 88 insertions(+) create mode 100644 android/AndroidManifest.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..b5fc4ca --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,62 @@ +<?xml version='1.0' encoding='utf-8'?> +<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name"> + <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" + android:name="org.qtproject.qt5.android.bindings.QtActivity" + android:label="@string/app_name" + android:screenOrientation="unspecified" + android:launchMode="singleTop"> + <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:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> + <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> + <meta-data android:value="@string/fatal_error_msg" android:name="android.app.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:largeScreens="true" android:normalScreens="true" android:anyDensity="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/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 [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
