]>
Commit | Line | Data |
---|---|---|
aef0361e MC |
1 | diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml |
2 | index 0564a8d..0356f33 100644 | |
3 | --- a/java/AndroidManifest.xml | |
4 | +++ b/java/AndroidManifest.xml | |
5 | @@ -1,5 +1,5 @@ | |
6 | <?xml version='1.0' encoding='utf-8'?> | |
0c5c3b89 | 7 | -<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> |
6f61b17c | 8 | - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name"> |
0c5c3b89 | 9 | +<manifest package="org.sigrok.pulseview" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> |
6f61b17c | 10 | + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name" android:icon="@drawable/logo"> |
0c5c3b89 MC |
11 | <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" |
12 | android:name="org.qtproject.qt5.android.bindings.QtActivity" | |
13 | @@ -9,21 +9,21 @@ | |
14 | <action android:name="android.intent.action.MAIN"/> | |
15 | <category android:name="android.intent.category.LAUNCHER"/> | |
aef0361e | 16 | </intent-filter> |
0c5c3b89 MC |
17 | - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> |
18 | + <meta-data android:name="android.app.lib_name" android:value="pulseview"/> | |
19 | <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> | |
20 | <meta-data android:name="android.app.repository" android:value="default"/> | |
aef0361e MC |
21 | <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> |
22 | <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> | |
0c5c3b89 MC |
23 | <!-- Deploy Qt libs as part of package --> |
24 | - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> | |
25 | + <meta-data android:name="android.app.bundle_local_qt_libs" android:value="0"/> | |
26 | <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> | |
27 | <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> | |
28 | <!-- Run with local libs --> | |
29 | - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> | |
30 | + <meta-data android:name="android.app.use_local_qt_libs" android:value="0"/> | |
31 | <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> | |
32 | - <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/> | |
33 | - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> | |
34 | - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> | |
35 | + <meta-data android:name="android.app.load_local_libs" android:value="libs/libgnustl_shared.so"/> | |
36 | + <meta-data android:name="android.app.load_local_jars" android:value=":"/> | |
37 | + <meta-data android:name="android.app.static_init_classes" android:value=":"/> | |
aef0361e | 38 | <!-- Messages maps --> |
0c5c3b89 MC |
39 | <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> |
40 | <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> | |
aef0361e MC |
41 | diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml |
42 | index bd6928f..68f017e 100644 | |
43 | --- a/java/res/values/strings.xml | |
44 | +++ b/java/res/values/strings.xml | |
45 | @@ -1,6 +1,6 @@ | |
46 | <?xml version='1.0' encoding='utf-8'?> | |
47 | <resources> | |
0c5c3b89 | 48 | - <string name="app_name"><!-- %%INSERT_APP_NAME%% --></string> |
aef0361e | 49 | + <string name="app_name">PulseView</string> |
0c5c3b89 | 50 | |
aef0361e MC |
51 | <string name="ministro_not_found_msg">Can\'t find Ministro service.\nThe application can\'t start.</string> |
52 | <string name="ministro_needed_msg">This application requires Ministro service. Would you like to install it?</string> | |
0c5c3b89 MC |
53 | diff --git a/java/res/values/libs.xml b/java/res/values/libs.xml |
54 | --- a/java/res/values/libs.xml 2014-05-17 11:09:29.855631921 +0200 | |
55 | +++ b/java/res/values/libs.xml 2014-05-17 11:13:04.380841784 +0200 | |
a044b5ef | 56 | @@ -13,6 +13,10 @@ |
0c5c3b89 MC |
57 | |
58 | <array name="qt_libs"> | |
59 | <!-- %%INSERT_QT_LIBS%% --> | |
60 | + <item>Qt5Core</item> | |
61 | + <item>Qt5Gui</item> | |
62 | + <item>Qt5Widgets</item> | |
a044b5ef | 63 | + <item>Qt5Svg</item> |
0c5c3b89 MC |
64 | </array> |
65 | ||
66 | <array name="bundled_in_lib"> | |
67 | diff --git a/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/java/src/org/qtproject/qt5/android/bindings/QtActivity.java | |
aef0361e | 68 | index 4ebf1f6..f4e3598 100644 |
0c5c3b89 MC |
69 | --- a/java/src/org/qtproject/qt5/android/bindings/QtActivity.java |
70 | +++ b/java/src/org/qtproject/qt5/android/bindings/QtActivity.java | |
71 | @@ -187,6 +187,14 @@ | |
72 | private void loadApplication(Bundle loaderParams) | |
aef0361e | 73 | { |
0c5c3b89 | 74 | try { |
bdf42f4b MC |
75 | + org.sigrok.androidutils.Environment.initEnvironment( |
76 | + getApplicationInfo().sourceDir); | |
aef0361e MC |
77 | + System.loadLibrary("gnustl_shared"); |
78 | + org.sigrok.androidutils.LibWrangler.setupLibs( | |
79 | + getAssets().open("liblist.txt"), | |
80 | + new File(getApplicationInfo().nativeLibraryDir), | |
81 | + new File(getFilesDir(), "lib")); | |
82 | + | |
0c5c3b89 MC |
83 | final int errorCode = loaderParams.getInt(ERROR_CODE_KEY); |
84 | if (errorCode != 0) { | |
85 | if (errorCode == INCOMPATIBLE_MINISTRO_VERSION) { | |
aef0361e MC |
86 | diff --git a/java/src/org/sigrok/androidutils/LibWrangler.java b/java/src/org/sigrok/androidutils/LibWrangler.java |
87 | new file mode 100644 | |
88 | index 0000000..0c9effe | |
89 | --- /dev/null | |
90 | +++ b/java/src/org/sigrok/androidutils/LibWrangler.java | |
91 | @@ -0,0 +1,63 @@ | |
92 | +package org.sigrok.androidutils; | |
93 | + | |
94 | +import java.io.InputStream; | |
95 | +import java.io.InputStreamReader; | |
96 | +import java.io.BufferedReader; | |
97 | +import java.io.IOException; | |
98 | +import java.io.File; | |
99 | + | |
100 | +public final class LibWrangler | |
101 | +{ | |
102 | + protected static String stripSoVersion(String s) | |
103 | + { | |
104 | + int p = s.lastIndexOf(".so."); | |
105 | + if (p >= 0) | |
106 | + s = s.substring(0, p+3); | |
107 | + return s; | |
108 | + } | |
109 | + | |
110 | + protected static void makeLink(File from, File to) | |
111 | + throws IOException | |
112 | + { | |
113 | + if (to.equals(from.getCanonicalFile())) { | |
114 | + // Symlink already correct | |
115 | + return; | |
116 | + } | |
117 | + from.delete(); | |
118 | + int rc; | |
119 | + Process proc = | |
120 | + Runtime.getRuntime().exec(new String[]{"ln", "-s", | |
121 | + to.getAbsolutePath(), | |
122 | + from.getAbsolutePath()}); | |
123 | + for(;;) { | |
124 | + try { | |
125 | + rc = proc.waitFor(); | |
126 | + break; | |
127 | + } catch(InterruptedException ie) { | |
128 | + } | |
129 | + } | |
130 | + if (rc != 0) | |
131 | + throw new IOException("Failed to create symlink "+from); | |
132 | + } | |
133 | + | |
134 | + public static void setupLibs(BufferedReader reader, File libDir1, File libDir2) | |
135 | + throws IOException | |
136 | + { | |
137 | + if (!libDir2.exists()) | |
138 | + libDir2.mkdir(); | |
139 | + | |
140 | + String libname; | |
141 | + while ((libname = reader.readLine()) != null) { | |
142 | + File shlib = new File(libDir2, libname); | |
143 | + makeLink(shlib, new File(libDir1, stripSoVersion(libname))); | |
144 | + System.load(shlib.getAbsolutePath()); | |
145 | + } | |
146 | + } | |
147 | + | |
148 | + public static void setupLibs(InputStream is, File libDir1, File libDir2) | |
149 | + throws IOException | |
150 | + { | |
151 | + setupLibs(new BufferedReader(new InputStreamReader(is, "US-ASCII")), | |
152 | + libDir1, libDir2); | |
153 | + } | |
154 | +} | |
bdf42f4b MC |
155 | diff --git a/java/src/org/sigrok/androidutils/Environment.java b/java/src/org/sigrok/androidutils/Environment.java |
156 | new file mode 100644 | |
157 | index 0000000..0c9effe | |
158 | --- /dev/null 2014-04-15 00:13:35.543030287 +0200 | |
159 | +++ b/java/src/org/sigrok/androidutils/Environment.java 2014-04-27 00:09:23.073513663 +0200 | |
160 | @@ -0,0 +1,21 @@ | |
161 | +package org.sigrok.androidutils; | |
162 | + | |
163 | +public final class Environment | |
164 | +{ | |
165 | + static private String[] environment; | |
166 | + | |
167 | + public static String[] getEnvironment() | |
168 | + { | |
169 | + return environment; | |
170 | + } | |
171 | + | |
172 | + public static void initEnvironment(String apkFile) | |
173 | + { | |
174 | + environment = new String[] | |
175 | + { | |
176 | + "PYTHONHOME", ".", | |
177 | + "PYTHONPATH", apkFile+"/assets/python3.3", | |
178 | + "SIGROKDECODE_DIR", apkFile+"/assets/libsigrokdecode/decoders", | |
179 | + }; | |
180 | + } | |
181 | +} |