From 7f5852facfc31950cc08e37e8d8ce6763add4802 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 3 Mar 2023 08:55:29 +0100 Subject: [PATCH] Debug info: added domain verification state --- app/src/main/java/eu/faircode/email/Log.java | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index e84874e0dc..e352c86a28 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -38,6 +38,8 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PermissionGroupInfo; import android.content.pm.PermissionInfo; +import android.content.pm.verify.domain.DomainVerificationManager; +import android.content.pm.verify.domain.DomainVerificationUserState; import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; @@ -2959,6 +2961,27 @@ public class Log { size += write(os, "\r\n"); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + try { + DomainVerificationManager dvm = Helper.getSystemService(context, DomainVerificationManager.class); + DomainVerificationUserState userState = dvm.getDomainVerificationUserState(context.getPackageName()); + Map hostToStateMap = userState.getHostToStateMap(); + for (String key : hostToStateMap.keySet()) { + Integer stateValue = hostToStateMap.get(key); + if (stateValue == DomainVerificationUserState.DOMAIN_STATE_VERIFIED) + size += write(os, String.format("Verified: %s\r\n", key)); + else if (stateValue == DomainVerificationUserState.DOMAIN_STATE_SELECTED) + size += write(os, String.format("selected: %s\r\n", key)); + else + size += write(os, String.format("Unverified: %s (%d)\r\n", key, + stateValue == null ? -1 : stateValue)); + } + } catch (Throwable ex) { + size += write(os, String.format("%s\r\n", ex)); + } + size += write(os, "\r\n"); + } + try { List works = WorkManager .getInstance(context)