mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-21 04:17:35 +00:00
* doc/emacs/android.texi (Android Startup, Android Environment): Document that restrictions on starting Emacs have been lifted. * java/README: Document Java for Emacs developers and how the Android port works. * java/org/gnu/emacs/EmacsApplication.java (EmacsApplication) (findDumpFile): New function. (onCreate): Factor out dump file finding functions to there. * java/org/gnu/emacs/EmacsNative.java (EmacsNative): Update function declarations. * java/org/gnu/emacs/EmacsNoninteractive.java (EmacsNoninteractive): New class. * java/org/gnu/emacs/EmacsService.java (EmacsService, getApkFile) (onCreate): Pass classpath to setEmacsParams. * java/org/gnu/emacs/EmacsThread.java (EmacsThread): Make run an override. * lisp/loadup.el: Don't dump on Android when noninteractive. * lisp/shell.el (shell--command-completion-data): Handle inaccessible directories. * src/Makefile.in (android-emacs): Link with gnulib. * src/android-emacs.c (main): Implement to launch app-process and then EmacsNoninteractive. * src/android.c (setEmacsParams): New argument `class_path'. Don't set stuff up when running noninteractive. * src/android.h (initEmacs): Likewise. * src/androidfont.c (init_androidfont): * src/androidselect.c (init_androidselect): Don't initialize when running noninteractive. * src/emacs.c (load_pdump): New argument `dump_file'. (android_emacs_init): Give new argument `dump_file' to `load_pdump'. * src/sfntfont-android.c (init_sfntfont_android): Don't initialize when running noninteractive.
80 lines
2.1 KiB
Java
80 lines
2.1 KiB
Java
/* Communication module for Android terminals. -*- c-file-style: "GNU" -*-
|
|
|
|
Copyright (C) 2023 Free Software Foundation, Inc.
|
|
|
|
This file is part of GNU Emacs.
|
|
|
|
GNU Emacs is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or (at
|
|
your option) any later version.
|
|
|
|
GNU Emacs is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
|
|
|
package org.gnu.emacs;
|
|
|
|
import java.io.File;
|
|
import java.io.FileFilter;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.app.Application;
|
|
import android.util.Log;
|
|
|
|
public class EmacsApplication extends Application
|
|
{
|
|
private static final String TAG = "EmacsApplication";
|
|
|
|
/* The name of the dump file to use. */
|
|
public static String dumpFileName;
|
|
|
|
public static void
|
|
findDumpFile (Context context)
|
|
{
|
|
File filesDirectory;
|
|
File[] allFiles;
|
|
String wantedDumpFile;
|
|
int i;
|
|
|
|
wantedDumpFile = ("emacs-" + EmacsNative.getFingerprint ()
|
|
+ ".pdmp");
|
|
|
|
/* Obtain a list of all files ending with ``.pdmp''. Then, look
|
|
for a file named ``emacs-<fingerprint>.pdmp'' and delete the
|
|
rest. */
|
|
filesDirectory = context.getFilesDir ();
|
|
allFiles = filesDirectory.listFiles (new FileFilter () {
|
|
@Override
|
|
public boolean
|
|
accept (File file)
|
|
{
|
|
return (!file.isDirectory ()
|
|
&& file.getName ().endsWith (".pdmp"));
|
|
}
|
|
});
|
|
|
|
/* Now try to find the right dump file. */
|
|
for (i = 0; i < allFiles.length; ++i)
|
|
{
|
|
if (allFiles[i].getName ().equals (wantedDumpFile))
|
|
dumpFileName = allFiles[i].getAbsolutePath ();
|
|
else
|
|
/* Delete this outdated dump file. */
|
|
allFiles[i].delete ();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void
|
|
onCreate ()
|
|
{
|
|
findDumpFile (this);
|
|
super.onCreate ();
|
|
}
|
|
};
|