[Android Apps and Games] cm5:
Someone that uses many different hotspots doesn't want to whitelist each one.

If BWOF is disabled, and the user leaves the hotspot area, wifi is still on scanning causing battery drain. With BWOF, when the user leaves the hotpost area and is no longer connected, it will turn the wifi off at least at next screen on/off but perhaps before too.

---------- Post added at 06:11 AM ---------- Previous post was at 05:23 AM ----------

-Delay 30 Seconds

-Wifi is initially off for this test

-Screen unlock enables BWOF

-Connection should be detected as caged

logcat -t 1000 -v time * | grep Better
05-21 05:53:07.214 I/BetterWifiOnOff.SetWifiStateService(10815): Called with extra true, false
05-21 05:53:07.214 D/BetterWifiOnOff.WifiControl(10815): Turning Wifi on
05-21 05:53:07.214 I/BetterWifiOnOff.SetWifiStateService(10815): scheduleWifiConnectedAlarm called
05-21 05:53:07.244 D/BetterWifiOnOff.ConnectionStatusHandler(10815): Wifi was turned on
05-21 05:53:08.095 I/BetterWifiOnOff.ConnectionStatusHandler(10815): Connected to null
05-21 05:53:08.986 I/BetterWifiOnOff.WifiControl(10815): Caged connection check retuned: 204
05-21 05:53:37.246 D/BetterWifiOnOff.WifiConnectedAlarmReceiver(12208): Alarm received: checking connection
05-21 05:53:37.246 D/BetterWifiOnOff.WifiControl(12208): A connection was detected, testing if an IP was assigned
05-21 05:53:37.246 D/BetterWifiOnOff.WifiControl(12208): IP address assigned: 1141024960. Wifi is connected
05-21 05:53:37.246 D/BetterWifiOnOff.WifiControl(12208): Wifilock status: false
05-21 05:53:37.246 D/BetterWifiOnOff.WifiConnectedAlarmReceiver(12208): Connection active: leaving Wifi on
05-21 05:53:37.276 I/BetterWifiOnOff.WifiControl(12208): Check for cage returned false. Thread status was false
05-21 05:53:37.276 D/BetterWifiOnOff.WifiConnectedAlarmReceiver(12208): Connection not caged: leaving Wifi on

Note the timestamp, the wifi didn't even connect yet, and 1 second from screen on the caged check is done. I'm not sure how this 204 is returned when wifi is still initializing. Don't think version 2.1B2 did this.

Now the same test starting with screen off but wifi already connected, and ip assigned, to a caged connection. Log after unlocking the screen:

logcat -t 1000 -v time * | grep Better
05-21 05:57:46.823 I/BetterWifiOnOff.SetWifiStateService(10815): Called with extra true, false
05-21 05:57:46.823 I/BetterWifiOnOff.SetWifiStateService(10815): scheduleWifiConnectedAlarm called
05-21 05:57:46.853 I/BetterWifiOnOff.WifiControl(10815): Caged connection check retuned: 302
05-21 05:58:16.855 D/BetterWifiOnOff.WifiConnectedAlarmReceiver(12208): Alarm received: checking connection
05-21 05:58:16.855 D/BetterWifiOnOff.WifiControl(12208): A connection was detected, testing if an IP was assigned
05-21 05:58:16.855 D/BetterWifiOnOff.WifiControl(12208): IP address assigned: 1141024960. Wifi is connected
05-21 05:58:16.855 D/BetterWifiOnOff.WifiControl(12208): Wifilock status: false
05-21 05:58:16.855 D/BetterWifiOnOff.WifiConnectedAlarmReceiver(12208): Connection active: leaving Wifi on
05-21 05:58:16.895 I/BetterWifiOnOff.WifiControl(12208): Check for cage returned false. Thread status was false
05-21 05:58:16.895 D/BetterWifiOnOff.WifiConnectedAlarmReceiver(12208): Connection not caged: leaving Wifi on

Now the correct code is returned right after screen on, http 302 a wifi portal login redirect, but the thread returned false, anything other than a 204 should be marked as a caged connection.