diff options
| author | Po Lu | 2023-07-29 12:49:36 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-29 12:49:36 +0800 |
| commit | 27fe17f0fc56ac11969dbbe54485cff8a4fdab32 (patch) | |
| tree | 0197d733d0988e9e92cc3ea791c1e5f419feb3f2 /java | |
| parent | 183c65e0c4471c995b1ed6d50b8ecdc8507da5d7 (diff) | |
| download | emacs-27fe17f0fc56ac11969dbbe54485cff8a4fdab32.tar.gz emacs-27fe17f0fc56ac11969dbbe54485cff8a4fdab32.zip | |
Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (DocIdEntry):
(getCacheEntry):
(CacheEntry):
(documentIdFromName1): Fix earlier change.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsSafThread.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/java/org/gnu/emacs/EmacsSafThread.java b/java/org/gnu/emacs/EmacsSafThread.java index 9c3e3deb408..cf067adc87b 100644 --- a/java/org/gnu/emacs/EmacsSafThread.java +++ b/java/org/gnu/emacs/EmacsSafThread.java | |||
| @@ -33,7 +33,9 @@ import android.os.Build; | |||
| 33 | import android.os.CancellationSignal; | 33 | import android.os.CancellationSignal; |
| 34 | import android.os.Handler; | 34 | import android.os.Handler; |
| 35 | import android.os.HandlerThread; | 35 | import android.os.HandlerThread; |
| 36 | import android.os.OperationCanceledException; | ||
| 36 | import android.os.ParcelFileDescriptor; | 37 | import android.os.ParcelFileDescriptor; |
| 38 | import android.os.SystemClock; | ||
| 37 | 39 | ||
| 38 | import android.util.Log; | 40 | import android.util.Log; |
| 39 | 41 | ||
| @@ -151,7 +153,7 @@ public final class EmacsSafThread extends HandlerThread | |||
| 151 | public | 153 | public |
| 152 | DocIdEntry () | 154 | DocIdEntry () |
| 153 | { | 155 | { |
| 154 | time = System.uptimeMillis (); | 156 | time = SystemClock.uptimeMillis (); |
| 155 | } | 157 | } |
| 156 | 158 | ||
| 157 | /* Return a cache entry comprised of the state of the file | 159 | /* Return a cache entry comprised of the state of the file |
| @@ -206,6 +208,10 @@ public final class EmacsSafThread extends HandlerThread | |||
| 206 | toplevel.idCache.put (documentId, entry); | 208 | toplevel.idCache.put (documentId, entry); |
| 207 | return entry; | 209 | return entry; |
| 208 | } | 210 | } |
| 211 | catch (OperationCanceledException e) | ||
| 212 | { | ||
| 213 | throw e; | ||
| 214 | } | ||
| 209 | catch (Throwable e) | 215 | catch (Throwable e) |
| 210 | { | 216 | { |
| 211 | return null; | 217 | return null; |
| @@ -220,8 +226,8 @@ public final class EmacsSafThread extends HandlerThread | |||
| 220 | public boolean | 226 | public boolean |
| 221 | isValid () | 227 | isValid () |
| 222 | { | 228 | { |
| 223 | return ((System.uptimeMillis () - time) | 229 | return ((SystemClock.uptimeMillis () - time) |
| 224 | < CACHE_INVALID_TIME); | 230 | < CACHE_INVALID_TIME * 1000); |
| 225 | } | 231 | } |
| 226 | }; | 232 | }; |
| 227 | 233 | ||
| @@ -240,14 +246,14 @@ public final class EmacsSafThread extends HandlerThread | |||
| 240 | CacheEntry () | 246 | CacheEntry () |
| 241 | { | 247 | { |
| 242 | children = new HashMap<String, DocIdEntry> (); | 248 | children = new HashMap<String, DocIdEntry> (); |
| 243 | time = System.uptimeMillis (); | 249 | time = SystemClock.uptimeMillis (); |
| 244 | } | 250 | } |
| 245 | 251 | ||
| 246 | public boolean | 252 | public boolean |
| 247 | isValid () | 253 | isValid () |
| 248 | { | 254 | { |
| 249 | return ((System.uptimeMillis () - time) | 255 | return ((SystemClock.uptimeMillis () - time) |
| 250 | < CACHE_INVALID_TIME); | 256 | < CACHE_INVALID_TIME * 1000); |
| 251 | } | 257 | } |
| 252 | }; | 258 | }; |
| 253 | 259 | ||
| @@ -740,7 +746,12 @@ public final class EmacsSafThread extends HandlerThread | |||
| 740 | obtained. Treat this as if the file does not | 746 | obtained. Treat this as if the file does not |
| 741 | exist. */ | 747 | exist. */ |
| 742 | 748 | ||
| 743 | children.remove (idEntry); | 749 | children.remove (component); |
| 750 | |||
| 751 | if (id == null) | ||
| 752 | id = DocumentsContract.getTreeDocumentId (uri); | ||
| 753 | |||
| 754 | id_return[0] = id; | ||
| 744 | 755 | ||
| 745 | if ((type == null | 756 | if ((type == null |
| 746 | || type.equals (Document.MIME_TYPE_DIR)) | 757 | || type.equals (Document.MIME_TYPE_DIR)) |