Fix build and running on Android 2.2
* INSTALL.android: Document that Android 2.2 is now supported, with caveats. * configure.ac (ANDROID_MIN_SDK, ANDROID_SDK_18_OR_EARLIER) (SYSTEM_TYPE, ANDROID_STUBIFY, SIZEOF_LONG): Correctly detect things missing on Android 2.2. * java/Makefile.in (ANDROID_JAR, JARSIGNER_FLAGS): * java/debug.sh (jdb, gdbserver, line): * java/org/gnu/emacs/EmacsApplication.java (findDumpFile): * java/org/gnu/emacs/EmacsService.java (onCreate): * java/org/gnu/emacs/EmacsThread.java (EmacsThread, run): Run parameter initialization on main thread. * src/android-asset.h (struct android_asset_manager) (struct android_asset, AAssetManager_fromJava, AAssetManager_open) (AAsset_close, android_asset_create_stream) (android_asset_read_internal, AAsset_openFileDescriptor) (AAsset_getLength, AAsset_getBuffer, AAsset_read): New file. * src/android.c (android_user_full_name, android_hack_asset_fd) (android_check_compressed_file): Implement for Android 2.2. * src/process.c (Fprocess_send_eof): Don't call tcdrain if unavailable. * src/sfntfont-android.c (system_font_directories): Fix compiler warning. * src/sfntfont.c (sfntfont_read_cmap): Correctly test rc of emacs_open. * src/textconv.c (handle_pending_conversion_events_1): Mark buffer UNINIT.
This commit is contained in:
@@ -39,6 +39,7 @@ JARSIGNER_FLAGS =
|
||||
ANDROID_JAR = @ANDROID_JAR@
|
||||
ANDROID_ABI = @ANDROID_ABI@
|
||||
ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@
|
||||
ANDROID_SDK_8_OR_EARLIER = @ANDROID_SDK_8_OR_EARLIER@
|
||||
|
||||
WARN_JAVAFLAGS = -Xlint:deprecation
|
||||
JAVAFLAGS = -classpath "$(ANDROID_JAR):." -target 1.7 -source 1.7 \
|
||||
@@ -53,6 +54,16 @@ else
|
||||
JARSIGNER_FLAGS =
|
||||
endif
|
||||
|
||||
# When building Emacs for Android 2.2, assets must not be compressed.
|
||||
# Otherwise, the asset manager fails to extract files larger than 1
|
||||
# MB.
|
||||
|
||||
ifneq (,$(ANDROID_SDK_8_OR_EARLIER))
|
||||
AAPT_ASSET_ARGS = -0 ""
|
||||
else
|
||||
AAPT_ASSET_ARGS =
|
||||
endif
|
||||
|
||||
SIGN_EMACS = -keystore emacs.keystore -storepass emacs1 $(JARSIGNER_FLAGS)
|
||||
SIGN_EMACS_V2 = sign --v2-signing-enabled --ks emacs.keystore \
|
||||
--debuggable-apk-permitted --ks-pass pass:emacs1
|
||||
@@ -192,7 +203,8 @@ emacs.apk-in: install_temp install_temp/assets/directory-tree \
|
||||
# of Android. Make sure not to generate R.java, as it's already been
|
||||
# generated.
|
||||
$(AM_V_AAPT) $(AAPT) p -I "$(ANDROID_JAR)" -F $@ \
|
||||
-f -M AndroidManifest.xml -A install_temp/assets \
|
||||
-f -M AndroidManifest.xml $(AAPT_ASSET_ARGS) \
|
||||
-A install_temp/assets \
|
||||
-S res -J install_temp
|
||||
$(AM_V_SILENT) pushd install_temp &> /dev/null; \
|
||||
$(AAPT) add ../$@ `find lib -type f`; \
|
||||
|
||||
@@ -32,6 +32,7 @@ jdb_port=64013
|
||||
jdb=no
|
||||
attach_existing=no
|
||||
gdbserver=
|
||||
gdb=gdb
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
@@ -51,6 +52,7 @@ while [ $# -gt 0 ]; do
|
||||
echo " --port PORT run the GDB server on a specific port"
|
||||
echo " --jdb-port PORT run the JDB server on a specific port"
|
||||
echo " --jdb run JDB instead of GDB"
|
||||
echo " --gdb use specified GDB binary"
|
||||
echo " --attach-existing attach to an existing process"
|
||||
echo " --gdbserver BINARY upload and use the specified gdbserver binary"
|
||||
echo " --help print this message"
|
||||
@@ -65,6 +67,10 @@ while [ $# -gt 0 ]; do
|
||||
"--jdb" )
|
||||
jdb=yes
|
||||
;;
|
||||
"--gdb" )
|
||||
shift
|
||||
gdb=$1
|
||||
;;
|
||||
"--gdbserver" )
|
||||
shift
|
||||
gdbserver=$1
|
||||
@@ -355,4 +361,4 @@ fi
|
||||
|
||||
# Finally, start gdb with any extra arguments needed.
|
||||
cd "$oldpwd"
|
||||
gdb --eval-command "target remote localhost:$gdb_port" $gdbargs
|
||||
$gdb --eval-command "target remote localhost:$gdb_port" $gdbargs
|
||||
|
||||
@@ -49,6 +49,7 @@ public class EmacsApplication extends Application
|
||||
for a file named ``emacs-<fingerprint>.pdmp'' and delete the
|
||||
rest. */
|
||||
filesDirectory = context.getFilesDir ();
|
||||
|
||||
allFiles = filesDirectory.listFiles (new FileFilter () {
|
||||
@Override
|
||||
public boolean
|
||||
|
||||
@@ -180,11 +180,11 @@ public class EmacsService extends Service
|
||||
public void
|
||||
onCreate ()
|
||||
{
|
||||
AssetManager manager;
|
||||
final AssetManager manager;
|
||||
Context app_context;
|
||||
String filesDir, libDir, cacheDir, classPath;
|
||||
double pixelDensityX;
|
||||
double pixelDensityY;
|
||||
final String filesDir, libDir, cacheDir, classPath;
|
||||
final double pixelDensityX;
|
||||
final double pixelDensityY;
|
||||
|
||||
SERVICE = this;
|
||||
handler = new Handler (Looper.getMainLooper ());
|
||||
@@ -210,13 +210,18 @@ public class EmacsService extends Service
|
||||
Log.d (TAG, "Initializing Emacs, where filesDir = " + filesDir
|
||||
+ ", libDir = " + libDir + ", and classPath = " + classPath);
|
||||
|
||||
EmacsNative.setEmacsParams (manager, filesDir, libDir,
|
||||
cacheDir, (float) pixelDensityX,
|
||||
(float) pixelDensityY,
|
||||
classPath, this);
|
||||
|
||||
/* Start the thread that runs Emacs. */
|
||||
thread = new EmacsThread (this, needDashQ);
|
||||
thread = new EmacsThread (this, new Runnable () {
|
||||
@Override
|
||||
public void
|
||||
run ()
|
||||
{
|
||||
EmacsNative.setEmacsParams (manager, filesDir, libDir,
|
||||
cacheDir, (float) pixelDensityX,
|
||||
(float) pixelDensityY,
|
||||
classPath, EmacsService.this);
|
||||
}
|
||||
}, needDashQ);
|
||||
thread.start ();
|
||||
}
|
||||
catch (IOException exception)
|
||||
|
||||
@@ -28,11 +28,16 @@ public class EmacsThread extends Thread
|
||||
/* Whether or not Emacs should be started -Q. */
|
||||
private boolean startDashQ;
|
||||
|
||||
/* Runnable run to initialize Emacs. */
|
||||
private Runnable paramsClosure;
|
||||
|
||||
public
|
||||
EmacsThread (EmacsService service, boolean startDashQ)
|
||||
EmacsThread (EmacsService service, Runnable paramsClosure,
|
||||
boolean startDashQ)
|
||||
{
|
||||
super ("Emacs main thread");
|
||||
this.startDashQ = startDashQ;
|
||||
this.paramsClosure = paramsClosure;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,6 +51,8 @@ public class EmacsThread extends Thread
|
||||
else
|
||||
args = new String[] { "libandroid-emacs.so", "-Q", };
|
||||
|
||||
paramsClosure.run ();
|
||||
|
||||
/* Run the native code now. */
|
||||
EmacsNative.initEmacs (args, EmacsApplication.dumpFileName,
|
||||
Build.VERSION.SDK_INT);
|
||||
|
||||
Reference in New Issue
Block a user