]>
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'?> | |
7 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="org.kde.necessitas.example"> | |
8 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="org.sigrok.pulseview"> | |
9 | <application android:name="org.kde.necessitas.origo.QtApplication" android:icon="@drawable/icon" android:label="@string/app_name"> | |
10 | <activity android:name="org.kde.necessitas.origo.QtActivity" android:label="@string/app_name" android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden" > | |
11 | <intent-filter> | |
12 | @@ -8,7 +8,7 @@ | |
13 | </intent-filter> | |
14 | <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> | |
15 | <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> | |
16 | - <meta-data android:name="android.app.lib_name" android:value=""/> | |
17 | + <meta-data android:name="android.app.lib_name" android:value="pulseview"/> | |
18 | <!-- Messages maps --> | |
19 | <meta-data android:name="android.app.ministro_not_found_msg" android:value="@string/ministro_not_found_msg"/> | |
20 | <meta-data android:name="android.app.ministro_needed_msg" android:value="@string/ministro_needed_msg"/> | |
21 | diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml | |
22 | index bd6928f..68f017e 100644 | |
23 | --- a/java/res/values/strings.xml | |
24 | +++ b/java/res/values/strings.xml | |
25 | @@ -1,6 +1,6 @@ | |
26 | <?xml version='1.0' encoding='utf-8'?> | |
27 | <resources> | |
28 | - <string name="app_name"></string> | |
29 | + <string name="app_name">PulseView</string> | |
30 | <string name="ministro_not_found_msg">Can\'t find Ministro service.\nThe application can\'t start.</string> | |
31 | <string name="ministro_needed_msg">This application requires Ministro service. Would you like to install it?</string> | |
32 | <string name="fatal_error_msg">Your application encountered a fatal error and cannot continue.</string> | |
33 | diff --git a/java/src/org/kde/necessitas/origo/QtActivity.java b/java/src/org/kde/necessitas/origo/QtActivity.java | |
34 | index 4ebf1f6..f4e3598 100644 | |
35 | --- a/java/src/org/kde/necessitas/origo/QtActivity.java | |
36 | +++ b/java/src/org/kde/necessitas/origo/QtActivity.java | |
37 | @@ -108,6 +108,12 @@ public class QtActivity extends Activity | |
38 | { | |
39 | try | |
40 | { | |
41 | + System.loadLibrary("gnustl_shared"); | |
42 | + org.sigrok.androidutils.LibWrangler.setupLibs( | |
43 | + getAssets().open("liblist.txt"), | |
44 | + new File(getApplicationInfo().nativeLibraryDir), | |
45 | + new File(getFilesDir(), "lib")); | |
46 | + | |
47 | if (loaderParams.getInt(ERROR_CODE_KEY) != 0) | |
48 | { // fatal error, show the error and quit | |
49 | AlertDialog errorDialog = new AlertDialog.Builder(QtActivity.this).create(); | |
50 | diff --git a/java/src/org/sigrok/androidutils/LibWrangler.java b/java/src/org/sigrok/androidutils/LibWrangler.java | |
51 | new file mode 100644 | |
52 | index 0000000..0c9effe | |
53 | --- /dev/null | |
54 | +++ b/java/src/org/sigrok/androidutils/LibWrangler.java | |
55 | @@ -0,0 +1,63 @@ | |
56 | +package org.sigrok.androidutils; | |
57 | + | |
58 | +import java.io.InputStream; | |
59 | +import java.io.InputStreamReader; | |
60 | +import java.io.BufferedReader; | |
61 | +import java.io.IOException; | |
62 | +import java.io.File; | |
63 | + | |
64 | +public final class LibWrangler | |
65 | +{ | |
66 | + protected static String stripSoVersion(String s) | |
67 | + { | |
68 | + int p = s.lastIndexOf(".so."); | |
69 | + if (p >= 0) | |
70 | + s = s.substring(0, p+3); | |
71 | + return s; | |
72 | + } | |
73 | + | |
74 | + protected static void makeLink(File from, File to) | |
75 | + throws IOException | |
76 | + { | |
77 | + if (to.equals(from.getCanonicalFile())) { | |
78 | + // Symlink already correct | |
79 | + return; | |
80 | + } | |
81 | + from.delete(); | |
82 | + int rc; | |
83 | + Process proc = | |
84 | + Runtime.getRuntime().exec(new String[]{"ln", "-s", | |
85 | + to.getAbsolutePath(), | |
86 | + from.getAbsolutePath()}); | |
87 | + for(;;) { | |
88 | + try { | |
89 | + rc = proc.waitFor(); | |
90 | + break; | |
91 | + } catch(InterruptedException ie) { | |
92 | + } | |
93 | + } | |
94 | + if (rc != 0) | |
95 | + throw new IOException("Failed to create symlink "+from); | |
96 | + } | |
97 | + | |
98 | + public static void setupLibs(BufferedReader reader, File libDir1, File libDir2) | |
99 | + throws IOException | |
100 | + { | |
101 | + if (!libDir2.exists()) | |
102 | + libDir2.mkdir(); | |
103 | + | |
104 | + String libname; | |
105 | + while ((libname = reader.readLine()) != null) { | |
106 | + File shlib = new File(libDir2, libname); | |
107 | + makeLink(shlib, new File(libDir1, stripSoVersion(libname))); | |
108 | + System.load(shlib.getAbsolutePath()); | |
109 | + } | |
110 | + } | |
111 | + | |
112 | + public static void setupLibs(InputStream is, File libDir1, File libDir2) | |
113 | + throws IOException | |
114 | + { | |
115 | + setupLibs(new BufferedReader(new InputStreamReader(is, "US-ASCII")), | |
116 | + libDir1, libDir2); | |
117 | + } | |
118 | +} |