Fixed no suitable network

This commit is contained in:
M66B 2018-12-01 13:59:55 +01:00
parent 31293ec6ba
commit 646180a856
1 changed files with 5 additions and 3 deletions

View File

@ -81,7 +81,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.mail.Address; import javax.mail.Address;
import javax.mail.AuthenticationFailedException; import javax.mail.AuthenticationFailedException;
@ -704,7 +703,7 @@ public class ServiceSynchronize extends LifecycleService {
} }
} }
private void monitorAccount(final EntityAccount account, final ServiceState state) throws NoSuchProviderException, TimeoutException { private void monitorAccount(final EntityAccount account, final ServiceState state) throws NoSuchProviderException {
final PowerManager pm = getSystemService(PowerManager.class); final PowerManager pm = getSystemService(PowerManager.class);
final PowerManager.WakeLock wl0 = pm.newWakeLock( final PowerManager.WakeLock wl0 = pm.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK, PowerManager.PARTIAL_WAKE_LOCK,
@ -2321,8 +2320,11 @@ public class ServiceSynchronize extends LifecycleService {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSynchronize.this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSynchronize.this);
boolean metered = prefs.getBoolean("metered", true); boolean metered = prefs.getBoolean("metered", true);
boolean suitable = (network != null && (metered || unmetered));
EntityLog.log(ServiceSynchronize.this, "suitable=" + suitable + " active=" + cm.getActiveNetworkInfo());
// The connected state is deliberately ignored // The connected state is deliberately ignored
return (metered || unmetered); return suitable;
} }
private boolean isEnabled() { private boolean isEnabled() {