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