diff options
| author | Po Lu | 2023-07-29 15:57:44 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-29 15:57:44 +0800 |
| commit | 4bf8b0a2e9db842283e9e3849e8d23573ba3b181 (patch) | |
| tree | 57265728723b457267126270254844b90be911e0 /src | |
| parent | 431fdda2ebbb6e93ea4eb705ec16a44b49c30c8d (diff) | |
| download | emacs-4bf8b0a2e9db842283e9e3849e8d23573ba3b181.tar.gz emacs-4bf8b0a2e9db842283e9e3849e8d23573ba3b181.zip | |
Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (postInvalidateCache):
New argument cacheName. Remove that file from the cache.
(accessDocument1): Consult the storage cache as well.
* java/org/gnu/emacs/EmacsService.java (deleteDocument): New
argument NAME.
* src/android.c (android_init_emacs_service): Add new argument.
* src/androidvfs.c (android_saf_delete_document)
(android_saf_tree_rmdir, android_saf_file_unlink): Pass name of
file being deleted to `deleteDocument'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/android.c | 3 | ||||
| -rw-r--r-- | src/androidvfs.c | 31 |
2 files changed, 25 insertions, 9 deletions
diff --git a/src/android.c b/src/android.c index 687c0b48a2a..a75193e5edd 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -1581,7 +1581,8 @@ android_init_emacs_service (void) | |||
| 1581 | "(Ljava/lang/String;Ljava/lang/String;" | 1581 | "(Ljava/lang/String;Ljava/lang/String;" |
| 1582 | "Ljava/lang/String;)Ljava/lang/String;"); | 1582 | "Ljava/lang/String;)Ljava/lang/String;"); |
| 1583 | FIND_METHOD (delete_document, "deleteDocument", | 1583 | FIND_METHOD (delete_document, "deleteDocument", |
| 1584 | "(Ljava/lang/String;Ljava/lang/String;)I"); | 1584 | "(Ljava/lang/String;Ljava/lang/String;" |
| 1585 | "Ljava/lang/String;)I"); | ||
| 1585 | #undef FIND_METHOD | 1586 | #undef FIND_METHOD |
| 1586 | } | 1587 | } |
| 1587 | 1588 | ||
diff --git a/src/androidvfs.c b/src/androidvfs.c index b175f7746f3..6c34aac9e3e 100644 --- a/src/androidvfs.c +++ b/src/androidvfs.c | |||
| @@ -3969,34 +3969,45 @@ android_saf_access (const char *uri_name, const char *id_name, | |||
| 3969 | 3969 | ||
| 3970 | /* Delete the document designated by DOC_ID within the tree identified | 3970 | /* Delete the document designated by DOC_ID within the tree identified |
| 3971 | through the URI TREE. Return 0 if the document has been deleted, | 3971 | through the URI TREE. Return 0 if the document has been deleted, |
| 3972 | set errno and return -1 upon failure. */ | 3972 | set errno and return -1 upon failure. |
| 3973 | |||
| 3974 | DOC_NAME should be the name of the file itself, as a file name | ||
| 3975 | whose constituent components lead to a document named DOC_ID. It | ||
| 3976 | isn't used to search for a document ID, but is used to invalidate | ||
| 3977 | the file cache. */ | ||
| 3973 | 3978 | ||
| 3974 | static int | 3979 | static int |
| 3975 | android_saf_delete_document (const char *tree, const char *doc_id) | 3980 | android_saf_delete_document (const char *tree, const char *doc_id, |
| 3981 | const char *doc_name) | ||
| 3976 | { | 3982 | { |
| 3977 | jobject id, uri; | 3983 | jobject id, uri, name; |
| 3978 | jmethodID method; | 3984 | jmethodID method; |
| 3979 | jint rc; | 3985 | jint rc; |
| 3980 | 3986 | ||
| 3981 | /* Build the strings holding the ID and URI. */ | 3987 | /* Build the strings holding the ID, URI and NAME. */ |
| 3982 | id = (*android_java_env)->NewStringUTF (android_java_env, | 3988 | id = (*android_java_env)->NewStringUTF (android_java_env, |
| 3983 | doc_id); | 3989 | doc_id); |
| 3984 | android_exception_check (); | 3990 | android_exception_check (); |
| 3985 | uri = (*android_java_env)->NewStringUTF (android_java_env, | 3991 | uri = (*android_java_env)->NewStringUTF (android_java_env, |
| 3986 | tree); | 3992 | tree); |
| 3987 | android_exception_check_1 (id); | 3993 | android_exception_check_1 (id); |
| 3994 | name = (*android_java_env)->NewStringUTF (android_java_env, | ||
| 3995 | doc_name); | ||
| 3996 | android_exception_check_2 (id, name); | ||
| 3988 | 3997 | ||
| 3989 | /* Now, try to delete the document. */ | 3998 | /* Now, try to delete the document. */ |
| 3990 | method = service_class.delete_document; | 3999 | method = service_class.delete_document; |
| 3991 | rc = (*android_java_env)->CallIntMethod (android_java_env, | 4000 | rc = (*android_java_env)->CallIntMethod (android_java_env, |
| 3992 | emacs_service, | 4001 | emacs_service, |
| 3993 | method, uri, id); | 4002 | method, uri, id, |
| 4003 | name); | ||
| 3994 | 4004 | ||
| 3995 | if (android_saf_exception_check (2, id, uri)) | 4005 | if (android_saf_exception_check (3, id, uri, name)) |
| 3996 | return -1; | 4006 | return -1; |
| 3997 | 4007 | ||
| 3998 | ANDROID_DELETE_LOCAL_REF (id); | 4008 | ANDROID_DELETE_LOCAL_REF (id); |
| 3999 | ANDROID_DELETE_LOCAL_REF (uri); | 4009 | ANDROID_DELETE_LOCAL_REF (uri); |
| 4010 | ANDROID_DELETE_LOCAL_REF (name); | ||
| 4000 | 4011 | ||
| 4001 | if (rc) | 4012 | if (rc) |
| 4002 | { | 4013 | { |
| @@ -4553,7 +4564,9 @@ android_saf_tree_rmdir (struct android_vnode *vnode) | |||
| 4553 | return -1; | 4564 | return -1; |
| 4554 | } | 4565 | } |
| 4555 | 4566 | ||
| 4556 | return android_saf_delete_document (vp->tree_uri, vp->document_id); | 4567 | return android_saf_delete_document (vp->tree_uri, |
| 4568 | vp->document_id, | ||
| 4569 | vp->name); | ||
| 4557 | } | 4570 | } |
| 4558 | 4571 | ||
| 4559 | static int | 4572 | static int |
| @@ -5173,7 +5186,9 @@ android_saf_file_unlink (struct android_vnode *vnode) | |||
| 5173 | struct android_saf_file_vnode *vp; | 5186 | struct android_saf_file_vnode *vp; |
| 5174 | 5187 | ||
| 5175 | vp = (struct android_saf_file_vnode *) vnode; | 5188 | vp = (struct android_saf_file_vnode *) vnode; |
| 5176 | return android_saf_delete_document (vp->tree_uri, vp->document_id); | 5189 | return android_saf_delete_document (vp->tree_uri, |
| 5190 | vp->document_id, | ||
| 5191 | vp->name); | ||
| 5177 | } | 5192 | } |
| 5178 | 5193 | ||
| 5179 | static int | 5194 | static int |