1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Remove redundant encoding of strings in androidvfs.c

* java/org/gnu/emacs/EmacsService.java (getDocumentTrees):
Accept PROVIDER as a String.

* src/android.c (android_init_emacs_service):

* src/androidvfs.c (android_saf_root_opendir): Adjust to match.
This commit is contained in:
Po Lu 2024-05-10 11:42:37 +08:00
parent dc5390d06a
commit ea2b251ab2
3 changed files with 14 additions and 25 deletions

View file

@ -1401,22 +1401,12 @@ public final class EmacsService extends Service
otherwise. */
public String[]
getDocumentTrees (byte provider[])
getDocumentTrees (String provider)
{
String providerName;
List<String> treeList;
List<UriPermission> permissions;
Uri uri;
try
{
providerName = new String (provider, "US-ASCII");
}
catch (UnsupportedEncodingException exception)
{
return null;
}
permissions = resolver.getPersistedUriPermissions ();
treeList = new ArrayList<String> ();
@ -1425,7 +1415,7 @@ public final class EmacsService extends Service
uri = permission.getUri ();
if (DocumentsContract.isTreeUri (uri)
&& uri.getAuthority ().equals (providerName)
&& uri.getAuthority ().equals (provider)
&& permission.isReadPermission ())
/* Make sure the tree document ID is encoded. Refrain from
encoding characters such as +:&?#, since they don't
@ -1435,6 +1425,9 @@ public final class EmacsService extends Service
" +:&?#"));
}
/* The empty string array that is ostensibly allocated to provide
the first argument provides just the type of the array to be
returned. */
return treeList.toArray (new String[0]);
}