From c1b0b854fc8bb3d10c90720a1d74ae744e709ebd Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 8 May 2015 18:06:08 -0400 Subject: [PATCH] on launch, check wifi if WIFI_STATE_ENABLED, the receiver handles the rest On launch, we need to get the current state of the Wifi. We only need to start the WifiStateChangeService on WIFI_STATE_ENABLED, since any other wifi state will be received by WifiStateChangeReceiver, which will launch WifiStateChangeService when appropriate. This reduces the chance that WifiStateChangeService will start when it is not needed. --- F-Droid/src/org/fdroid/fdroid/FDroidApp.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/F-Droid/src/org/fdroid/fdroid/FDroidApp.java b/F-Droid/src/org/fdroid/fdroid/FDroidApp.java index 51d9ab3b7..a5a929e46 100644 --- a/F-Droid/src/org/fdroid/fdroid/FDroidApp.java +++ b/F-Droid/src/org/fdroid/fdroid/FDroidApp.java @@ -241,8 +241,7 @@ public class FDroidApp extends Application { FDroidApp.initWifiSettings(); WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); int wifiState = wifiManager.getWifiState(); - if (wifiState == WifiManager.WIFI_STATE_ENABLING - || wifiState == WifiManager.WIFI_STATE_ENABLED) + if (wifiState == WifiManager.WIFI_STATE_ENABLED) startService(new Intent(this, WifiStateChangeService.class)); // if the HTTPS pref changes, then update all affected things Preferences.get().registerLocalRepoHttpsListeners(new ChangeListener() {