mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-28 08:11:05 -08:00
Update Android port
* 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.
This commit is contained in:
parent
6f9a2a8f29
commit
0900bfbcc5
17 changed files with 1306 additions and 109 deletions
|
|
@ -41,6 +41,9 @@ import android.app.Service;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager.ApplicationInfoFlags;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
import android.net.Uri;
|
||||
|
|
@ -118,8 +121,38 @@ public class EmacsService extends Service
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings ("deprecation")
|
||||
private String
|
||||
getApkFile ()
|
||||
{
|
||||
PackageManager manager;
|
||||
ApplicationInfo info;
|
||||
|
||||
manager = getPackageManager ();
|
||||
|
||||
try
|
||||
{
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU)
|
||||
info = manager.getApplicationInfo ("org.gnu.emacs", 0);
|
||||
else
|
||||
info = manager.getApplicationInfo ("org.gnu.emacs",
|
||||
ApplicationInfoFlags.of (0));
|
||||
|
||||
/* Return an empty string upon failure. */
|
||||
|
||||
if (info.sourceDir != null)
|
||||
return info.sourceDir;
|
||||
|
||||
return "";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi (Build.VERSION_CODES.GINGERBREAD)
|
||||
String
|
||||
private String
|
||||
getLibraryDirectory ()
|
||||
{
|
||||
int apiLevel;
|
||||
|
|
@ -142,7 +175,7 @@ public class EmacsService extends Service
|
|||
{
|
||||
AssetManager manager;
|
||||
Context app_context;
|
||||
String filesDir, libDir, cacheDir;
|
||||
String filesDir, libDir, cacheDir, classPath;
|
||||
double pixelDensityX;
|
||||
double pixelDensityY;
|
||||
|
||||
|
|
@ -162,13 +195,18 @@ public class EmacsService extends Service
|
|||
libDir = getLibraryDirectory ();
|
||||
cacheDir = app_context.getCacheDir ().getCanonicalPath ();
|
||||
|
||||
/* Now provide this application's apk file, so a recursive
|
||||
invocation of app_process (through android-emacs) can
|
||||
find EmacsNoninteractive. */
|
||||
classPath = getApkFile ();
|
||||
|
||||
Log.d (TAG, "Initializing Emacs, where filesDir = " + filesDir
|
||||
+ " and libDir = " + libDir);
|
||||
+ ", libDir = " + libDir + ", and classPath = " + classPath);
|
||||
|
||||
EmacsNative.setEmacsParams (manager, filesDir, libDir,
|
||||
cacheDir, (float) pixelDensityX,
|
||||
(float) pixelDensityY,
|
||||
this);
|
||||
classPath, this);
|
||||
|
||||
/* Start the thread that runs Emacs. */
|
||||
thread = new EmacsThread (this, needDashQ);
|
||||
|
|
@ -491,8 +529,6 @@ public class EmacsService extends Service
|
|||
public static void
|
||||
startEmacsService (Context context)
|
||||
{
|
||||
PendingIntent intent;
|
||||
|
||||
if (EmacsService.SERVICE == null)
|
||||
{
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue