1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-02 21:24:34 +00:00

Debug: persisted URIs

This commit is contained in:
M66B 2023-01-18 08:44:45 +01:00
parent 3b54622f42
commit 241778348a

View file

@ -32,6 +32,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.UriPermission;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@ -2857,6 +2858,21 @@ public class Log {
long size = 0;
File file = attachment.getFile(context);
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
try {
List<UriPermission> uperms = context.getContentResolver().getPersistedUriPermissions();
if (uperms != null)
for (UriPermission uperm : uperms) {
size += write(os, String.format("%s r=%b w=%b %s\r\n",
uperm.getUri().toString(),
uperm.isReadPermission(),
uperm.isWritePermission(),
new Date(uperm.getPersistedTime())));
}
} catch (Throwable ex) {
size += write(os, String.format("%s\r\n", ex));
}
size += write(os, "\r\n");
try {
PackageInfo pi = context.getPackageManager()
.getPackageInfo(BuildConfig.APPLICATION_ID, PackageManager.GET_PERMISSIONS);