summaryrefslogtreecommitdiff
path: root/java/org/gnu/emacs/EmacsSafThread.java
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-07-29 12:49:36 +0800
committerPo Lu <luangruo@yahoo.com>2023-07-29 12:49:36 +0800
commit27fe17f0fc56ac11969dbbe54485cff8a4fdab32 (patch)
tree0197d733d0988e9e92cc3ea791c1e5f419feb3f2 /java/org/gnu/emacs/EmacsSafThread.java
parent183c65e0c4471c995b1ed6d50b8ecdc8507da5d7 (diff)
Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (DocIdEntry): (getCacheEntry): (CacheEntry): (documentIdFromName1): Fix earlier change.
Diffstat (limited to 'java/org/gnu/emacs/EmacsSafThread.java')
-rw-r--r--java/org/gnu/emacs/EmacsSafThread.java25
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;
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))