mirror of https://github.com/M66B/FairEmail.git
Debug info: private DNS
This commit is contained in:
parent
b9417aeab6
commit
2d9d06fe55
|
@ -441,6 +441,36 @@ public class ConnectionHelper {
|
|||
return null;
|
||||
}
|
||||
|
||||
static Boolean isPrivateDnsActive(Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
||||
return null;
|
||||
ConnectivityManager cm = Helper.getSystemService(context, ConnectivityManager.class);
|
||||
if (cm == null)
|
||||
return null;
|
||||
Network active = cm.getActiveNetwork();
|
||||
if (active == null)
|
||||
return null;
|
||||
LinkProperties props = cm.getLinkProperties(active);
|
||||
if (props == null)
|
||||
return null;
|
||||
return props.isPrivateDnsActive();
|
||||
}
|
||||
|
||||
static String getPrivateDnsServerName(Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
||||
return null;
|
||||
ConnectivityManager cm = Helper.getSystemService(context, ConnectivityManager.class);
|
||||
if (cm == null)
|
||||
return null;
|
||||
Network active = cm.getActiveNetwork();
|
||||
if (active == null)
|
||||
return null;
|
||||
LinkProperties props = cm.getLinkProperties(active);
|
||||
if (props == null)
|
||||
return null;
|
||||
return props.getPrivateDnsServerName();
|
||||
}
|
||||
|
||||
static boolean isIoError(Throwable ex) {
|
||||
if (ex instanceof MessagingException &&
|
||||
ex.getMessage() != null &&
|
||||
|
|
|
@ -1036,8 +1036,6 @@ public class DebugHelper {
|
|||
"\r\n");
|
||||
size += write(os, " caps=" + c + "\r\n");
|
||||
size += write(os, " props=" + p + "\r\n\r\n");
|
||||
size += write(os, " private DNS=" +
|
||||
(p == null ? null : p.isPrivateDnsActive() + " (" + p.getPrivateDnsServerName() + ")") + "\r\n");
|
||||
|
||||
for (Network network : cm.getAllNetworks()) {
|
||||
size += write(os, (network.equals(active) ? "active=" : "network=") + network + "\r\n");
|
||||
|
@ -1096,6 +1094,9 @@ public class DebugHelper {
|
|||
size += write(os, "VPN active=" + ConnectionHelper.vpnActive(context) + "\r\n");
|
||||
size += write(os, "Data saving=" + ConnectionHelper.isDataSaving(context) + "\r\n");
|
||||
size += write(os, "Airplane=" + ConnectionHelper.airplaneMode(context) + "\r\n");
|
||||
size += write(os, "Private" +
|
||||
" DNS=" + ConnectionHelper.isPrivateDnsActive(context) +
|
||||
" server=" + ConnectionHelper.getPrivateDnsServerName(context) + "\r\n");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
size += write(os, "Cleartext permitted= " +
|
||||
NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted() + "\r\n");
|
||||
|
|
Loading…
Reference in New Issue