From: Po Lu Date: Sat, 29 Jul 2023 04:49:36 +0000 (+0800) Subject: Update Android port X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=27fe17f0fc56ac11969dbbe54485cff8a4fdab32;p=emacs.git Update Android port * java/org/gnu/emacs/EmacsSafThread.java (DocIdEntry): (getCacheEntry): (CacheEntry): (documentIdFromName1): Fix earlier change. --- 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; import android.os.CancellationSignal; import android.os.Handler; import android.os.HandlerThread; +import android.os.OperationCanceledException; import android.os.ParcelFileDescriptor; +import android.os.SystemClock; import android.util.Log; @@ -151,7 +153,7 @@ public final class EmacsSafThread extends HandlerThread public DocIdEntry () { - time = System.uptimeMillis (); + time = SystemClock.uptimeMillis (); } /* Return a cache entry comprised of the state of the file @@ -206,6 +208,10 @@ public final class EmacsSafThread extends HandlerThread toplevel.idCache.put (documentId, entry); return entry; } + catch (OperationCanceledException e) + { + throw e; + } catch (Throwable e) { return null; @@ -220,8 +226,8 @@ public final class EmacsSafThread extends HandlerThread public boolean isValid () { - return ((System.uptimeMillis () - time) - < CACHE_INVALID_TIME); + return ((SystemClock.uptimeMillis () - time) + < CACHE_INVALID_TIME * 1000); } }; @@ -240,14 +246,14 @@ public final class EmacsSafThread extends HandlerThread CacheEntry () { children = new HashMap (); - time = System.uptimeMillis (); + time = SystemClock.uptimeMillis (); } public boolean isValid () { - return ((System.uptimeMillis () - time) - < CACHE_INVALID_TIME); + return ((SystemClock.uptimeMillis () - time) + < CACHE_INVALID_TIME * 1000); } }; @@ -740,7 +746,12 @@ public final class EmacsSafThread extends HandlerThread obtained. Treat this as if the file does not exist. */ - children.remove (idEntry); + children.remove (component); + + if (id == null) + id = DocumentsContract.getTreeDocumentId (uri); + + id_return[0] = id; if ((type == null || type.equals (Document.MIME_TYPE_DIR))