]> git.eshelyaron.com Git - emacs.git/commitdiff
Update Android port
authorPo Lu <luangruo@yahoo.com>
Sun, 3 Sep 2023 12:13:29 +0000 (20:13 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 3 Sep 2023 12:21:14 +0000 (20:21 +0800)
* java/org/gnu/emacs/EmacsService.java (browseUrl): Confer
rights to write the URI indefinitely.

java/org/gnu/emacs/EmacsService.java

index 404796cd08cecf3d72d19fc4b42aa33300b68b72..fb123769bdfb6b26dee8850409c0eaffc9466f03 100644 (file)
@@ -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
          {