From 6278e15f62c7b3e3b360689bbe292a3f0d9ef8f5 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 3 Sep 2023 20:13:29 +0800 Subject: [PATCH] Update Android port * java/org/gnu/emacs/EmacsService.java (browseUrl): Confer rights to write the URI indefinitely. --- java/org/gnu/emacs/EmacsService.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java index 404796cd08c..fb123769bdf 100644 --- a/java/org/gnu/emacs/EmacsService.java +++ b/java/org/gnu/emacs/EmacsService.java @@ -643,13 +643,18 @@ public final class EmacsService extends Service uri.getPath ()); } - Log.d (TAG, ("browseUri: browsing " + url - + " --> " + uri.getPath () - + " --> " + uri)); - intent = new Intent (Intent.ACTION_VIEW, uri); + + /* Set several flags on the Intent prompting the system to + permit the recipient to read and edit the URI + indefinitely. */ + intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK - | Intent.FLAG_GRANT_READ_URI_PERMISSION); + | Intent.FLAG_GRANT_READ_URI_PERMISSION + | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) + intent.addFlags (Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); } else { -- 2.39.2