yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] chamonix:
Release 0.8.1

Last release is up after lots of testing on wakelock detection and it now should work. Make sure to disable network traffic detection for testing as having both on may give you a hard time understanding what is going on.

Other fixes are included too, see post #1 for complete list.

Please let me know if you see a need for network activity detection now that wakelock detection works. I feel it's not required anymore and too complex in regards to buffering and other caching mechanisms and would like to remove it if it's not vital to anyone.

I making a feature freeze on 0.8.1 (minus the network activity detection if you agree) and prepare for a 1.0 to be released to google play (UI polish, translations, usability). Once done I will go on with the other feature requests in a release pace of about 1 release per month as I usually do.

I keep my word and BetterWifiOnOff will stay free with ads but fully featured. There will be a "support the dev" version for 1 EUR turning off ads but without feature enhancement.

Suggestions are as always welcome
[Android Apps and Games] p107r0:
I'd have two small ones, if I may:

1. could you provide an option to automatically switch the data connection on when wifi is off and vice versa

2. would it be possible for the app to remember if wifi was turned on/off by the user, so when e.g. I turn wifi off manually then the app will not turn it on - until it is switched on by me again
[Android Apps and Games] Pkt_Lnt:
Version 0.8.1 will not keep connected to a whitelisted network. I use my phone as a voip softphone at home, and need to keep wifi connected as I wander from room to room, upstairs and down. Version 0.8.0 worked fine, I have reverted to it for now. Log attached.
[Android Apps and Games] patsmike:
IT WORKS!! This is amazzzing!!! Thanks for all the work...you've been awesome, and very humble for a dev - I had no idea you were the one who created bbs until very recently :)
[Android Apps and Games] twe90kid:
Is it just me or tthe screen keeps turning on when wifi is on? For example when streaming and wifi is being controlled, I noticed that the screen would turn on then off.
[Android Apps and Games] chamonix:
There is no code doing that in the app. Could you take a logcat and try to mark times / find patterns documenting that? The only thing happening when a wakelock is recognised (assuming yourhave set the prefs to respect that) is that the phone is woken up by an alarm to check if the wakelock is gone. An alarm is no reason to turn the screen on though.
[Android Apps and Games] chamonix:
Unfortunately the log is filtered. Could you please provide a plain unfiltered logcat?
[Android Apps and Games] Pkt_Lnt:
Will do tonight at home. Thanks for the help.

Galaxy Nexus / Tapatalk 2
[Android Apps and Games] Pkt_Lnt:
I use SuperSU, and have it set to reverify apps. It will repeatedly turn the screen on asking for root access if you install a new app or update one. Could that be it?
[Android Apps and Games] Pkt_Lnt:
Here is another try for logs. Using adb logcat from the computer keeps wifi connected because the phone is charging. Here ia an aLogcat app log and one from the app. I did not open either to look at them before archiving, so hopefully no filtering. If there is a clean way to capture with the phone not connected, please let me know. Thanks you again for the app and the help.

Gnex, Codename Android ROM, franco kernel.
[Android Apps and Games] akshay7394:
How is this any different from what JuiceDefender already does?
[Android Apps and Games] yhrn:
-- sorry wrong post ---
[Android Apps and Games] p107r0:
we here just like this one more
[Android Apps and Games] Pkt_Lnt:
Juice Defender slows down my phone, makes it lag, just takes too much memory, and wants to control things I do not want it to control. I paid for Ultimate and ran it on three phones. It has not been updated in ages, and is not at all Jelly Bean friendly or capable.

For me, this is a far better solution, with just the precise amount of wifi control without meddling in other areas of the data I/O interface.
[Android Apps and Games] akshay7394:
Fair enough. Thanks for taking the time :)
[Android Apps and Games] chamonix:
I will check the log you posted tomorrow. You don't need to run logcat synchronously with the events as it has a buffer so you can reproduce the problem without being plugged and save the dump afterwards with adb logcat -d > file
[Android Apps and Games] chamonix:
Without going into the discussion whether jd saves or causes battery drain I wrote bwof because I believe in tools fulfilling one purpose as in "a generalist can not be a specialist"
[Android Apps and Games] Pkt_Lnt:
Ok, got it. I knew that from the great logcat tutorial, was tired and not thinking last night. Here is the logcat as well. As always, thank you.
[Android Apps and Games] corrsea:
Just reporting that the latest version of the app is working well on the sgs3 I19300. I have tested it 'out of the box' without exploring any of the advanced features yet. It's giving me excellent battery battery drain overnight of only 0.1 to 0.2% per hour.

Thank you for all your efforts with this.
[Android Apps and Games] ferdossi:
WidgetLocker

Hi,

Is Widgetlocker considered as screen lock?

Because I configured BW to enable WIFI only at screen unlock, and I noticed that when I turn on the screen, WIFI is on even if I did not unlock widget locker.

Thx
[Android Apps and Games] darren1:
In Advanced settings of Widetlocker make sure "Retain System Keyguard" is ticked. Works fine then.
[Android Apps and Games] ferdossi:
Thx, worked great
[Android Apps and Games] foosion:
I'd like to make sure my understanding is correct.

I'm happy with my battery life when I'm connected to a router. From what I can tell, I don't have a problem when I'm not near a router. From what I can tell, my battery drains quickly when I'm near a router that I'm not connected to (presumably because it's spending energy trying to connect).

Will better wifi help prevent battery drain from being near routers I'm not connected to?

I have syncing set to push rather than to check periodically, if that matters.

Sorry if this is repetitive or obvious.
[Android Apps and Games] chamonix:
yes it will. BetterWifiOnOff will turn off your Wifi when no connection is made to an accesentials point, even if there are some nearby. Using the whitelisted SSIDs you can narrow down the access points even more to a list of trusted ones.

The drain from "foreign" routers have at least two known causes:

- Wifi sniffing by google maps

- potential rx_wake kernel wakelocks caused by incoming traffic waking you your phone

This tool was conceived to circumvent thoses cases (and other)
[Android Apps and Games] chamonix:
Unfortunately I couldn't find anything about SSID whitelist handling in those logs, not in the other logcat you provided. Could you please try to reproduce? Unfortunately I don't have the problem myself so there is not much I can do
[Android Apps and Games] foosion:
Would the key settings to prevent drain from "foreign" routers (those I don't connect to automatically) be:

Make sure it's always running:

Start on boot - check

Run as foreground - check

Rules for leaving wifi on:

only if connected - check

if connected check for cage - check

if network activity - check [is this needed if only if connected is checked?]

I'm happy to have the phone sync often,

Rules for turning wifi off - uncheck all
[Android Apps and Games] twe90kid:
Anyway for the app to detect wifi tether is being used? I hate how it kills my tether connection when I need to screen on the phone while tethering
[Android Apps and Games] chamonix:
Let me look into that

Edit: will be added to 0.9 (#40)

Edit2: Added, testing
[Android Apps and Games] chamonix:
Release 0.9

This is the last release till 1.0 to be released to google play. From now on I'll freeze the features till 1.0 and focus on bugfixing and a few UI things.

Changelog is in post #1
[Android Apps and Games] Anakha56:
Not sure if this feature has been requested but could you not read the SSID list from the wpa_supplicant.conf file and then that the user could select the SSID from a list instead of typing it in? Reason for asking is because some SSID's have either long names or weird characters. Just a thought. :)
[Android Apps and Games] chamonix:
It's on my list of improvements. No need to read the conf as there is api but I didn't code it yet as it is a little bit tricky to add a custom dialog to populate prefs.

Anyway that's technical stuff and I will add a list view with check boxes
[Android Apps and Games] foosion:
I'm puzzled. It doesn't turn off wifi when I expect it to

I have it set up:

unchecked: on when screen unlocked and on when screen on

checked: on when plugged in, if plugged, only if connected, if connected check for cage, if in call, if network activity

everything after that is unchecked

I went outside, where there is no wifi. Wifi was on every time I checked. The log reported every time I unlocked, turned screen on, turned screen off, but it never turned wifi off.

What am I missing?
[Android Apps and Games] mamouton:
Do you have it set to turn on at boot? Here are my settings.

---------- Post added at 08:00 AM ---------- Previous post was at 07:57 AM ----------

I noticed a few typos that should be fixed before you release it.

If in a call section should be leave wifi on if not of

Wifi tethering section should be leave on not of

for consistently purposes under the rules for leaving wifi on add the word in after if plugged to match your language with the other sections.

This is a great app when I reflash any rom this is one of the first apps I install.
[Android Apps and Games] foosion:
If that was directed at me, I do have it set to turn on at boot. I'm sure it was running since it's recording a log file.
[Android Apps and Games] chamonix:
This leads me to a feature I absolutely will have to add before releasing, for diag purposes: the creation of a logcat.

Could you please provide a logcat as it is pretty hard to check the decisions made based on what you told us. The prefs look fine to me anyway so it's right that you wonder.

Edit: an a feature to dump prefs
[Android Apps and Games] chamonix:
https://github.com/asksven/BetterWifiOnOff/issues/42
[Android Apps and Games] chamonix:
What would you guys think of a default mode not showing all the options / rules from prefs for "basic" users and an "expert" mode to turn all on?

I feel that for many users a few prefs with default options for the hidden onces may be easier because of a reduced number of choices. An pref "Advanced" would then of course enable all prefs and allow fine tuning.

A "simple" mode would be:

Service setting (all hidden)

Rules for turning Wifi on (all visible)

Rules for leaving Wifi on

Only if connected (on by default but hidden)

Check for cage (off by default but hidden)

If in call (I feel this pref could be removed completely and the behavior aleays be as "on")

If netwotk activity (off by default and hidden)

If wakelock is held (on by default but hidden)

If Wifi tethering (I feel this pref could be removed completely and the behavior aleays be as "on"

Rules whn plugged in

Wifilocks (off by default and hidden)

Rules for turining Wifi off (all on by default and hidden)

Own logfile: not really required as I will provide logcat with grep on BetterWifiOnOff

Any thoughts?

Edit: you are welcome to comment this here as well: https://github.com/asksven/BetterWifiOnOff/issues/44

But if you feel more comfortable keeping the discusion in the thread is ok too, I'll update the issue
[Android Apps and Games] RovG:
Sounds like a good idea. It will make the app novice friendly. You may also want to add an option under advanced setting that more experienced users can enable that will always take them to the advanced option mode.
[Android Apps and Games] chamonix:
The prefs screen will be the same for both basic and advanced, I will just be hiding / showing stuff from code in order to avoid maintaining two layouts
[Android Apps and Games] foosion:
Here's the log file. I was away from wifi 7:40-8:10 this morning. Is there some other info I can provide?
[Android Apps and Games] chamonix:
That is the "own log" and it does not contain enough information unfortunately. I really need a plain unfiltered logcat
[Android Apps and Games] foosion:
Here's an alogcat file. Is there something else I should be doing, as this doesn't look very interesting.
[Android Apps and Games] chamonix:
That logcat looks indeed pretty short. Are there any filters applied to the app you are using to create it?
[Android Apps and Games] Pkt_Lnt:
Here is another logcat (adb logcat -d > file.txt) and a screenshot that appears to show the ignore whitelisted SSID settings, recognizing them and then stating shutdown in 30 seconds, which it did. :(

This is with version 0.9, still version 0.8 works fine keeping my wifi on so sip calls care received.

One note on the aLogcat or other apps, if you use them on JellyBean, access to logs changed so they have to be converted to system apps to work correctly.
[Android Apps and Games] chamonix:
Release 0.10

New release is up, one step further to the release to gplay. Check post #1 for changes
[Android Apps and Games] foosion:
No. That's what alogcat offered upon installation. Are there better settings or a better app? Does it matter that I'm not rooted?

I'm on JellyBean. Can I convert to a system app if I'm unrooted? If so, how? If not, can I use adb?
[Android Apps and Games] Pkt_Lnt:
Well, yes, you can make it a system app with adb push /system/app and set permissions.

You can get a logcat in adb with "adb logcat -d > file.txt".
[Android Apps and Games] chamonix:
I am not aware of any limitation as logcat is not a log. Could you please the in app option for debug log present in 0.40 and post the file called betterwifionoff-timestamp?
[Android Apps and Games] mamouton:
I like the new setup. I think this will work well for the average user that doesn't know what to tweak.
[Android Apps and Games] foosion:
I just installed the latest version and will post after my next journey away from my router.
[Android Apps and Games] Pkt_Lnt:
I have seen this discussed a few times, and here is a link to what has changed in Jelly Bean that prevents logcat apps from reading the system logs.

http://stackoverflow.com/questions/11461650/read-logs-permission-on-jelly-bean-api-16
[Android Apps and Games] foosion:
Here's the log file. Am I missing a setting, as this looks short? On screen, I see:

10:28 - logging started

then a lot of screen unlocked, screen on, screen off

If nothing else, you can see my settings
[Android Apps and Games] chamonix:
OK, grep was obviously a bad idea as it seems to be busybox related and so not always present. I will post a fix for that in a few hours
[Android Apps and Games] chamonix:
It is a feature that apps are restricted to their own entries. The decision was made but poorly communicated. As betterwifionoff handles its own log now there should be no restrictions. I did just make the mistake of assuming grep is part of the Shell by default and will fix this tonight
[Android Apps and Games] chamonix:
Release 0.10.1

Fix is up for logcat saving.
[Android Apps and Games] MarcoJHB:
This is awesome I must give it a try...
[Android Apps and Games] foosion:
I went for a brief walk at about 06:00 and returned to my router at 06:14. The log file only reports at the end, when I re-connected with my router.

The IP address listed in the log is neither the IP of my phone (which is an 192.168 address) nor my external ISP connection. Nonetheless, I've changed the IP address out of paranoia.

How do I tell the program to start and then stop logcat recording? I'll try going out of range and saving a log from there.

EDIT: I've attached a second log from while away from the router. The IP address appears to be the same as I edited out from the prior log.

The problem seems to be that the app shows me as connected when I'm not.
[Android Apps and Games] chamonix:
There is no need to tell the app to start/stop recording logcat as logcat records all the time in a buffer anyway. Writing a logcat just retrieves this buffer.

From what your logcat suggests there is nothing happening to turn wifi off when screen goes off. This would be consistent with the setting:

wifi_off_when_screen_off = false

Is this on purpose?
[Android Apps and Games] chamonix:
Release 1.0RC1

A first release candidate for gplay release is up.
[Android Apps and Games] gschnasl:
Hi,

I've granted root permission to the app.

In the debugging log are no data from logcat ( Unable to open log device '/dev/log/system': Permission denied).

If I save the logcat from BetterBatteryStat it works fine.

In betterwifionoff I can't see the "Berechtigung: sens. Logdateirn auslesen".

Gesendet von meinem GT-I9100 mit Tapatalk 2
[Android Apps and Games] chamonix:
There indeed has been a change in how android handles the access to logcat. I will add that specific perm: https://github.com/asksven/BetterWifiOnOff/issues/49

Edit: fixed in RC2
[Android Apps and Games] chamonix:
Release 1.0RC2

Fixes mssing perms for android version pre-JB
[Android Apps and Games] Pkt_Lnt:
I have to leave off too or my white listed ssid is disconnected. Here is a log.

http://db.tt/ai9JzOsp

Here is a log with off when screen off not checked.

http://db.tt/JRTm3cwj

Galaxy Nexus / Tapatalk 2
[Android Apps and Games] chamonix:
I am sorry but I don't get you. The first log shows:

D/BetterWifiOnOff.WifiConnectedAlarmReceiver(10051): Alarm received: checking connection
D/BetterWifiOnOff.WifiControl(10051): A connection was detected, testing if an IP was assigned
D/BetterWifiOnOff.WifiControl(10051): IP address assigned: 1711384768. Wifi is connected
D/WifiManagerProxy(10051): mActiveLockCount is 0
D/WifiManagerProxy(10051): 0 Wifilocks detected
D/BetterWifiOnOff.WifiControl(10051): Wifilock status: false
D/BetterWifiOnOff.WifiConnectedAlarmReceiver(10051): Access Point wihtelisted: leaving Wifi on

In summary: Wifi stays on as you are connected to a whitelisted access point.

This is consistent to your preference:

2012-09-29 12:22:54 wifi_on_if_whitelisted = true (Boolean)

Now I can't see anything wrong with that log so I guess I am missing something. can you please explain what you were expecting and where in the log the app does not behave like it should?
[Android Apps and Games] Pkt_Lnt:
I use VoIP for sip calls on wifi, so I want to keep it enabled when connected.

If I check the box under RULES FOR TURNING WIFI OFF, and choose to check "Off when screen off", my wifi does turn off, in spite of what the log shows. I call my number and the call goes to voice mail. I wake the screen, the wifi indicator in the status bar is off, and I am connected to data.

If I do NOT check that box, my wifi stays on as desired.

Attaching a screen shot on wakeup, first showing no wifi and data on (carrier name below lock button) while "Off when screen off" IS checked, second showing wifi on as expected with the "Off when screen off" is NOT checked.

And a log file.

https://www.dropbox.com/s/ovqtr0jmlrau32c/betterwifionoff-2012-09-29_132018277.txt
[Android Apps and Games] chamonix:
OK now I understand you use case!

You want wifi to stay on when screen goes off. In that case you have correctly nchecked that option.

As betterwifionoff does not turn your wifi off if this is unchecked (so said the logs) there is another place you should look: the wifi sleep policy (settings - wifi - menu advanced - keep wifi on during sleep) : this should say "always" in you case.

Your use case is I guess not covered completely by betterwifionoff yet (I guess) so let's me state what you wish for, we'll validate that and I'll add it as a feature.

You want betterwifionoff to turn wifi on once your white listed access point is in range and leave wifi on as long as this access point is in range. Correct? For that we'll need some location magic detecting you home zone to trigger a regular check for your white listed access point. Once it is detected wifi stays on until the connectivity changes and the connection is gone.

Can you confirm on that or give me your thoughts?
[Android Apps and Games] yhrn:
Hi,

I think I want something different but somewhat related. This is how I'd like BWON to behave:

When screen is unlocked wifi is turned on.

If a network connection is established within the configured timeout wifi is left on. Otherwise wifi is turned off again.

When the screen goes off wifi is turned off if all of the following conditions are met: 1) no wakelock is held, 2) no network traffic is detected and 3) the network is not whitelisted

Some location magic that could be used to turn wifi on when a whitelisted AP is within range would be an added bonus if it could be done with little added overhead but to me it's not that important - turning on the screen once when i get home is no big effort.

As you might have seen from my previous post I have been struggling a bit with understanding how BWON is supposed to work but after checking your code briefly and testing some more I think I understand a bit more. Assuming "On when screen unlocked" and "Off when screen off" are checked this is how I think BWON will behave (please correct me if I'm wrong):

Starting state: Screen off, wifi off

Screen is unlocked: BWON turns on wifi and schedules a "leave wifi on check" after the timeout called "Connection timeout"

"Leave wifi on check" triggered: BWON goes through the enabled "Rules for leaving wifi on" and if all of them are fulfilled wifi is left on, otherwise it is disabled. Some rules (like the wakelock one) will cause BWON to schedule a new check for later, provided wifi was left on. Also, BWON will listen for connection changes and reevaluate the rules if this happens.

Screen is turned off: BWON schedules a "turn wifi off check" after the timeout called "Wifi off timeout"

"Turn wifi off check" triggered: BWON turns wifi off, unless some of the enabled "Rules for leaving wifi on" are fulfilled (such rules include the wakelock rule but not the "Only if connected" rule). If wifi is not turned off a new "turn wifi off check" is scheduled (at least for the wakelock rule).

If this is correct I find the way BWON is configured a bit bit counter intuitive. The main ting is that a few of the "Rules for leaving wifi on" are applied in two contexts; both when checking if wifi should be left on while the screen is still on and also when the screen is turned off, and the others are only applied in the first case. Since this difference is not obvious from the settings screen (to me at least) it becomes confusing.

Also, the "Connection timeout" and its description indicates that it only applies to the "Only if connected" rule but I think it applies to all "Rules for leaving wifi on".
[Android Apps and Games] foosion:
This is on purpose. I'd like wifi on so that the phone can sync, even if the screen is off.

What I'm trying to do is cut down on power drain trying to connect to routers that won't allow connections (for example, routers that require WPA or other logins) or possibly open routers that I chose not to connect to. It seems this situation uses much power, based on seeing higher drain when I'm near routers that I'm not connected to. I was hoping better wifi would help in this situation, using the "only if connected" setting. I may be misunderstanding either the power drain or what better wifi does.

It also seems power drain is higher when there's no router available and I was hoping better wifi would help. This seems a different situation and power drain seems lower than when there are unconnected routers. Again, I may misunderstand.

The log shows an IP address I don't recognize. It's not the IP address of my router. The IP address shows even when I'm not near any routers.