mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 23:12:55 +00:00
Fixed network connectivity on older Android versions
This commit is contained in:
parent
3e93251c69
commit
b7c057d720
1 changed files with 6 additions and 4 deletions
|
@ -747,19 +747,20 @@ public class Helper {
|
||||||
if (log)
|
if (log)
|
||||||
EntityLog.log(context, "isMetered: active caps=" + caps);
|
EntityLog.log(context, "isMetered: active caps=" + caps);
|
||||||
|
|
||||||
if (!caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
|
if (!caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) { // 21
|
||||||
if (log)
|
if (log)
|
||||||
EntityLog.log(context, "isMetered: no internet");
|
EntityLog.log(context, "isMetered: no internet");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)) {
|
if (!caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)) { // 21
|
||||||
if (log)
|
if (log)
|
||||||
EntityLog.log(context, "isMetered: active restricted");
|
EntityLog.log(context, "isMetered: active restricted");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_FOREGROUND)) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
|
||||||
|
!caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_FOREGROUND)) { // 28
|
||||||
if (log)
|
if (log)
|
||||||
EntityLog.log(context, "isMetered: active background");
|
EntityLog.log(context, "isMetered: active background");
|
||||||
return null;
|
return null;
|
||||||
|
@ -805,7 +806,8 @@ public class Helper {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_FOREGROUND)) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
|
||||||
|
!caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_FOREGROUND)) {
|
||||||
if (log)
|
if (log)
|
||||||
EntityLog.log(context, "isMetered: underlying background");
|
EntityLog.log(context, "isMetered: underlying background");
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue