]> git.eshelyaron.com Git - emacs.git/commit
Implement notification callbacks on Android
authorPo Lu <luangruo@yahoo.com>
Mon, 11 Mar 2024 13:40:47 +0000 (21:40 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 11 Mar 2024 17:15:40 +0000 (18:15 +0100)
commitb4dfa3ed419c6a5dd3d0e7f70929bea589fa0a33
tree3d2a6549e08d12668889d316358ad721f42f7a9e
parent847594faf4ac0470a8948807afe63533c8bd2438
Implement notification callbacks on Android

* doc/lispref/os.texi (Desktop Notifications): Document that
:on-cancel, :on-action and :actions are now supported on
Android.

* java/org/gnu/emacs/EmacsActivity.java (onNewIntent): New
function.

* java/org/gnu/emacs/EmacsDesktopNotification.java
(NOTIFICATION_ACTION, NOTIFICATION_TAG, NOTIFICATION_DISMISSED):
New constants.  <actions, titles>: New fields.
(insertActions): New function.
(display1, display): Insert actions on Jelly Bean and up, and
arrange to be notified when the notification is dismissed.
(CancellationReceiver): New class.

* java/org/gnu/emacs/EmacsNative.java (sendNotificationDeleted)
(sendNotificationAction): New functions.

* src/android.c (sendDndDrag, sendDndUri, sendDndText): Correct
return types.
(sendNotificationDeleted, sendNotificationAction)
(android_exception_check_5, android_exception_check_6): New
functions.

* src/android.h:

* src/androidgui.h (struct android_notification_event): New
structure.
(union android_event): New member for notification events.

* src/androidselect.c (android_init_emacs_desktop_notification):
Update JNI signatures.
(android_notifications_notify_1, Fandroid_notifications_notify):
New arguments ACTIONS, ACTION_CB and CANCEL_CB.  Convert and
record them as appropriate.
(android_notification_deleted, android_notification_action): New
functions.
(syms_of_androidselect): Prepare a hash table of outstanding
notifications.
<QCactions, QCon_action, QCon_cancel> New defsyms.

* src/androidterm.c (handle_one_android_event)
<ANDROID_NOTIFICATION_DELETED>
<ANDROID_NOTIFICATION_ACTION>: Dispatch event contents to
androidselect.c for processing.

* src/androidterm.h:

* src/androidvfs.c (java_string_class): Export.

* src/keyboard.c (kbd_buffer_get_event) <NOTIFICATION_EVENT>:
Call callback specified by the event.

* src/termhooks.h (enum event_kind) [HAVE_ANDROID]: New
enum NOTIFICATION_EVENT.

(cherry picked from commit a7a37341cad230448e487d0ffa343eeeb8a66a65)
13 files changed:
doc/lispref/os.texi
java/org/gnu/emacs/EmacsActivity.java
java/org/gnu/emacs/EmacsDesktopNotification.java
java/org/gnu/emacs/EmacsNative.java
src/android.c
src/android.h
src/androidgui.h
src/androidselect.c
src/androidterm.c
src/androidterm.h
src/androidvfs.c
src/keyboard.c
src/termhooks.h