static
{
+ /* Older versions of Android cannot link correctly with shared
+ libraries that link with other shared libraries built along
+ Emacs unless all requisite shared libraries are explicitly
+ loaded from Java.
+
+ Every time you add a new shared library dependency to Emacs,
+ please add it here as well. */
+
+ try
+ {
+ System.loadLibrary ("png_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("selinux_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("crypto_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("pcre_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("packagelistparser_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("gnutls_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("gmp_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("nettle_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("p11-kit_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("tasn1_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("hogweed_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("jansson_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("jpeg_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("tiff_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("xml2_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
+ try
+ {
+ System.loadLibrary ("icuuc_emacs");
+ }
+ catch (UnsatisfiedLinkError exception)
+ {
+ /* Ignore this exception. */
+ }
+
System.loadLibrary ("emacs");
};
};
int rc;
String what;
+ /* Because the ProcessBuilder functions necessary to redirect
+ process output are not implemented on Android 7 and earlier,
+ print a generic error message. */
+
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
+ return ("This is likely because the Emacs server"
+ + " is not running, or because you did"
+ + " not grant Emacs permission to access"
+ + " external storage.");
+
cache = getCacheDir ();
file = new File (cache, "emacsclient.log");
what = "";
Use TITLE as the title of the dialog. If TEXT is non-NULL,
display that text in the dialog. Otherwise, use the contents of
- emacsclient.log in the cache directory instead. */
+ emacsclient.log in the cache directory instead, or describe why
+ that file cannot be read. */
public void
finishFailure (final String title, final String text)
EmacsClientThread thread;
File file;
- file = new File (getCacheDir (), "emacsclient.log");
-
libDir = getLibraryDirectory ();
builder = new ProcessBuilder (libDir + "/libemacsclient.so",
fileName, "--reuse-frame",
"--timeout=10", "--no-wait");
- /* Redirect standard error to a file so that errors can be
- meaningfully reported. */
+ /* Redirection is unfortunately not possible in Android 7 and
+ earlier. */
- if (file.exists ())
- file.delete ();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
+ {
+ file = new File (getCacheDir (), "emacsclient.log");
- builder.redirectError (file);
+ /* Redirect standard error to a file so that errors can be
+ meaningfully reported. */
+
+ if (file.exists ())
+ file.delete ();
+
+ builder.redirectError (file);
+ }
/* Track process output in a new thread, since this is the UI
thread and doing so here can cause deadlocks when EmacsService