From 824d26b98709fb5063fc949a5f84789e62a68c3a Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 11 Nov 2023 15:46:40 +0100 Subject: [PATCH] Debug info: OpenKeychain permissions --- app/src/main/java/eu/faircode/email/Log.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 56125d6157..754df54099 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -3506,9 +3506,20 @@ public class Log { size += write(os, String.format("%s\r\n", p)); size += write(os, "\r\n"); - size += write(os, String.format("%s=%b\r\n", - PgpHelper.getPackageName(context), - PgpHelper.isOpenKeychainInstalled(context))); + String pgpPackage = PgpHelper.getPackageName(context); + boolean pgpInstalled = PgpHelper.isOpenKeychainInstalled(context); + size += write(os, String.format("%s=%b\r\n", pgpPackage, pgpInstalled)); + + if (pgpInstalled) + try { + PackageInfo pi = pm.getPackageInfo(pgpPackage, PackageManager.GET_PERMISSIONS); + for (int i = 0; i < pi.requestedPermissions.length; i++) { + boolean granted = ((pi.requestedPermissionsFlags[i] & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0); + size += write(os, String.format("- %s=%b\r\n", pi.requestedPermissions[i], granted)); + } + } catch (Throwable ex) { + size += write(os, String.format("%s\r\n", ex)); + } try { int maxKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength("AES");