emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 27fe17f0fc5 4/5: Update Android port


From: Po Lu
Subject: feature/android 27fe17f0fc5 4/5: Update Android port
Date: Sat, 29 Jul 2023 00:50:24 -0400 (EDT)

branch: feature/android
commit 27fe17f0fc56ac11969dbbe54485cff8a4fdab32
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Update Android port
    
    * java/org/gnu/emacs/EmacsSafThread.java (DocIdEntry):
    (getCacheEntry):
    (CacheEntry):
    (documentIdFromName1): Fix earlier change.
---
 java/org/gnu/emacs/EmacsSafThread.java | 25 ++++++++++++++++++-------
 1 file 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;
 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<String, DocIdEntry> ();
-      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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]