return manager.thing;
}
+
+ public void
+ restartEmacs ()
+ {
+ Intent intent;
+
+ intent = new Intent (this, EmacsActivity.class);
+ intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ startActivity (intent);
+ System.exit (0);
+ }
};
jmethodID name_keysym;
jmethodID sync;
jmethodID browse_url;
+ jmethodID restart_emacs;
};
struct android_emacs_pixmap
FIND_METHOD (sync, "sync", "()V");
FIND_METHOD (browse_url, "browseUrl", "(Ljava/lang/String;)"
"Ljava/lang/String;");
+ FIND_METHOD (restart_emacs, "restartEmacs", "()V");
#undef FIND_METHOD
}
return tem;
}
+/* Tell the system to restart Emacs in a short amount of time, and
+ then kill Emacs. Never return. This is used to implement
+ `restart-emacs'. */
+
+_Noreturn void
+android_restart_emacs (void)
+{
+ /* Try to call the Java side function. Normally, this should call
+ System.exit to terminate this process. */
+ (*android_java_env)->CallVoidMethod (android_java_env,
+ emacs_service,
+ service_class.restart_emacs);
+
+ /* Exit anyway, in case EmacsService did not do so. */
+ exit (0);
+}
+
\f
#else /* ANDROID_STUBIFY */
extern void android_wait_event (void);
extern void android_toggle_on_screen_keyboard (android_window, bool);
extern void android_window_updated (android_window, unsigned long);
+extern _Noreturn void android_restart_emacs (void);
\f
#ifndef WINDOWSNT
/* Do some checking before shutting down Emacs, because errors
can't be meaningfully reported afterwards. */
- if (!NILP (restart))
+ if (!NILP (restart)
+ /* Don't perform the following checks when Emacs is running as
+ an Android GUI application, because there the system is
+ relied on to restart Emacs. */
+#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
+ && !android_init_gui
+#endif
+ )
{
/* This is very unlikely, but it's possible to execute a binary
(on some systems) with no argv. */
if (!NILP (restart))
{
turn_on_atimers (false);
+#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
+ /* Re-executing the Emacs process created by the system doesn't
+ work. Instead, schedule a restart for a few hundered
+ milliseconds and exit Emacs. */
+ if (android_init_gui)
+ android_restart_emacs ();
+#endif
#ifdef WINDOWSNT
if (w32_reexec_emacs (initial_cmdline, initial_wd) < 0)
#else