diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in
index 923c5a005d5..3c9e30713b6 100644
--- a/java/AndroidManifest.xml.in
+++ b/java/AndroidManifest.xml.in
@@ -72,7 +72,7 @@ along with GNU Emacs. If not, see . -->
android:extractNativeLibs="true">
@@ -84,6 +84,8 @@ along with GNU Emacs. If not, see . -->
@@ -137,6 +139,7 @@ along with GNU Emacs. If not, see . -->
+
diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java b/java/org/gnu/emacs/EmacsOpenActivity.java
index 268a9abd7b1..e987e067a73 100644
--- a/java/org/gnu/emacs/EmacsOpenActivity.java
+++ b/java/org/gnu/emacs/EmacsOpenActivity.java
@@ -184,7 +184,9 @@ private class EmacsClientThread extends Thread
intent = new Intent (EmacsOpenActivity.this,
EmacsActivity.class);
- intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ /* This means only an existing frame will be displayed. */
+ intent.addFlags (Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity (intent);
EmacsOpenActivity.this.finish ();
@@ -285,6 +287,11 @@ else if (apiLevel >= Build.VERSION_CODES.DONUT)
return;
}
+ /* Set an appropriate theme. */
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ setTheme (android.R.style.Theme_DeviceDefault);
+
/* Now see if the action specified is supported by Emacs. */
if (action.equals ("android.intent.action.VIEW")
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java
index 5c2b77b0125..e921b972c2c 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -794,7 +794,10 @@ private class Coordinate
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
- /* Touch up event. */
+ case MotionEvent.ACTION_CANCEL:
+ /* Touch up event. Android documentation says ACTION_CANCEL
+ should be treated as more or less equivalent to ACTION_UP,
+ so that is what is done here. */
EmacsNative.sendTouchUp (this.handle, (int) event.getX (index),
(int) event.getY (index),
event.getEventTime (), pointerID);