mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 22:21:18 +00:00
Simplification
This commit is contained in:
parent
53d281c55f
commit
f142e0b647
1 changed files with 4 additions and 2 deletions
|
@ -151,15 +151,17 @@ public class ConnectionHelper {
|
|||
|
||||
private static Boolean isMetered(Context context) {
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm == null)
|
||||
return null;
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
NetworkInfo ani = (cm == null ? null : cm.getActiveNetworkInfo());
|
||||
NetworkInfo ani = cm.getActiveNetworkInfo();
|
||||
if (ani == null || !ani.isConnected())
|
||||
return null;
|
||||
return cm.isActiveNetworkMetered();
|
||||
}
|
||||
|
||||
Network active = (cm == null ? null : cm.getActiveNetwork());
|
||||
Network active = cm.getActiveNetwork();
|
||||
if (active == null) {
|
||||
Log.i("isMetered: no active network");
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue