1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-19 01:10:57 -08:00

Update Android port

* doc/emacs/android.texi (Android Startup): Document changes to
emacsclient wrapper.
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity)
(startEmacsClient): Open EmacsActivity if the service is not
running.
* java/org/gnu/emacs/EmacsService.java (onCreate):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run): Pass
any file to open to Emacs.
* lisp/term/android-win.el (handle-args-function): Implement.
This commit is contained in:
Po Lu 2023-03-13 13:25:02 +08:00
parent c3524b15aa
commit b776feb7f2
5 changed files with 54 additions and 10 deletions

View file

@ -20,24 +20,32 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
package org.gnu.emacs;
import java.lang.Thread;
import java.util.Arrays;
import android.os.Build;
import android.util.Log;
public class EmacsThread extends Thread
{
private static final String TAG = "EmacsThread";
/* Whether or not Emacs should be started -Q. */
private boolean startDashQ;
/* Runnable run to initialize Emacs. */
private Runnable paramsClosure;
/* Whether or not to open a file after starting Emacs. */
private String fileToOpen;
public
EmacsThread (EmacsService service, Runnable paramsClosure,
boolean startDashQ)
boolean startDashQ, String fileToOpen)
{
super ("Emacs main thread");
this.startDashQ = startDashQ;
this.paramsClosure = paramsClosure;
this.fileToOpen = fileToOpen;
}
@Override
@ -46,14 +54,27 @@ public class EmacsThread extends Thread
{
String args[];
if (!startDashQ)
args = new String[] { "libandroid-emacs.so", };
if (fileToOpen == null)
{
if (!startDashQ)
args = new String[] { "libandroid-emacs.so", };
else
args = new String[] { "libandroid-emacs.so", "-Q", };
}
else
args = new String[] { "libandroid-emacs.so", "-Q", };
{
if (!startDashQ)
args = new String[] { "libandroid-emacs.so",
fileToOpen, };
else
args = new String[] { "libandroid-emacs.so", "-Q",
fileToOpen, };
}
paramsClosure.run ();
/* Run the native code now. */
Log.d (TAG, "run: " + Arrays.toString (args));
EmacsNative.initEmacs (args, EmacsApplication.dumpFileName,
Build.VERSION.SDK_INT);
}