mirror of https://github.com/M66B/FairEmail.git
Fail-safe
This commit is contained in:
parent
7710722b0a
commit
bc811325ab
|
@ -343,23 +343,26 @@ class ImageHelper {
|
||||||
lld.setLevel(1);
|
lld.setLevel(1);
|
||||||
|
|
||||||
boolean slow = true;
|
boolean slow = true;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||||
// 2G GSM ~14.4 Kbps
|
try {
|
||||||
// G GPRS ~26.8 Kbps
|
// 2G GSM ~14.4 Kbps
|
||||||
// E EDGE ~108.8 Kbps
|
// G GPRS ~26.8 Kbps
|
||||||
// 3G UMTS ~128 Kbps
|
// E EDGE ~108.8 Kbps
|
||||||
// H HSPA ~3.6 Mbps
|
// 3G UMTS ~128 Kbps
|
||||||
// H+ HSPA+ ~14.4 Mbps-23.0 Mbps
|
// H HSPA ~3.6 Mbps
|
||||||
// 4G LTE ~50 Mbps
|
// H+ HSPA+ ~14.4 Mbps-23.0 Mbps
|
||||||
// 4G LTE-A ~500 Mbps
|
// 4G LTE ~50 Mbps
|
||||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
// 4G LTE-A ~500 Mbps
|
||||||
Network active = (cm == null ? null : cm.getActiveNetwork());
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
NetworkCapabilities caps = (active == null ? null : cm.getNetworkCapabilities(active));
|
Network active = (cm == null ? null : cm.getActiveNetwork());
|
||||||
if (caps != null) {
|
NetworkCapabilities caps = (active == null ? null : cm.getNetworkCapabilities(active));
|
||||||
int kbps = caps.getLinkDownstreamBandwidthKbps();
|
if (caps != null) {
|
||||||
slow = (kbps < SLOW_CONNECTION);
|
int kbps = caps.getLinkDownstreamBandwidthKbps();
|
||||||
|
slow = (kbps < SLOW_CONNECTION);
|
||||||
|
}
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ExecutorService executor = (slow ? executor_1 : executor_n);
|
ExecutorService executor = (slow ? executor_1 : executor_n);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue