yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] Klaipedaville:
I have another quick question, please. For example there is a phone call. I respond and keep talking for 30 minutes. Does LD "wake up" and keep connectivity on during these 30 minutes while I talk? Are there any options to keep connectivity off during calls? I do not normally do both (let's say surfing the net and speaking on the phone) at the same time so I think it's an extra battery/juice waste in this case (during the phone calls that is).
[Android Apps and Games] Flyview:
I believe LD works as usual during a phone call, if you manually shut the screen off. Otherwise, putting the phone to your ear and having the phone turn the screen off doesn't actually produce a screen off event. If you are using the except if active option, data will not turn off during a phone call.
[Android Apps and Games] ratbags:
That's a good suggestion though. I believe the xposed app smart network has an option to keep connectivity off on incoming call.
[Android Apps and Games] Klaipedaville:
Thank you. I may have to download the xposed framework just to give it a try. Does it work there on incoming calls only? What about outgoing calls? Plus, do you have any ideas if it's going to be compatible with LeanDroid and won't cause any "hiccups" :D and other conflicts?

---------- Post added at 08:17 AM ---------- Previous post was at 08:02 AM ----------

But you normally and usually keep on moving during a phone call so the the screen goes on and off time to time, unless you speak motionlessly and like a monument, moving your lips only :D

Then if "except if active option" is turned off does it mean that your phone will turn off WiFi/Data during a phone call? What else will it turn off if "except if active option" is disabled?

Are there any ways to set something like this, "Do not enable WiFi/Data when an 'app' (for example dialer [phone calls]) is running"?
[Android Apps and Games] fatspirit:
Mobile data is always off during a call except if your phone supports VoLTE and it's enabled. In-call screen off event shouldn't trigger LD's screen off actions.
[Android Apps and Games] cuteness_overload:
Strange behavior when switching off wifi

I have one question that is probably only remotely connected to LeanDroid - but I guess that only users of this (or a similar) app would notice this behavior : Since updating to MM on my Note 4, everytime, wifi is switched off, the phone stays active for pretty much exactly one minute. In the battery chart, it looks like this:

[unfortunately I am not allowed to post any picture :rolleyes:]

=> Does anybody else experience this behavior? For me, this effectively kills all savings that I would gain from switching off wifi.

With the help of Amplify I traced it down to the ConnectivityService wakelock, which kinda makes sense. But .. well, one minute seems a little extreme ;)
[Android Apps and Games] tr1cky1:
Any Alternative? Switching to 2g does not work with dual sim.
[Android Apps and Games] Flyview:
Yes, I have noticed a ConnectivityService wakelock as well. If you have a turn off time of 10+ min as recommended, this won't really be a big issue.

Unfortunately I don't have a dual SIM phone to play around with, or I might actually be able to make it work on Lollipop+. Are you able to get it to turn off data or switch to 2G on one of the SIMs?
[Android Apps and Games] tr1cky1:
Wifi and mobile data didn't disable.

As far as I can see the only thing the app did was regularely turn GPS to battery saving Mode when I had it set to device only.

I'm running CM13 on a oneplus 3 with xposed and root.
[Android Apps and Games] Flyview:
Wi-Fi wouldn't be affected by dual SIM. Please post your full settings.
[Android Apps and Games] tr1cky1:
Yesterdays battery stats:

As you can see WiFi on all the time.

Settings:
[Android Apps and Games] rossarnie:
It's not my app, so it's not my decision. I just think it would be a handy improvement to do it automatically. Manually? I can do everything manually... I can turn WiFi or data on manually every 15 minutes for one minute... The whole point of this excellent app is so we don't have to do it manually.
[Android Apps and Games] Flyview:
The whole point of the app is to turn data off when you aren't using it. If you're using Whatsapp a lot, it should stay on. For example, you don't want to set the "Disable time" to 1 minute, if you're going to be picking up the phone every 3 minutes to send a Whatsapp message. If you've set it to 1 minute, but then actually letting the phone sit until it hits 10minutes to sync, that's fine. At night, what will happen? It will turn on connections for 1 minute every 10 minutes. In 8 hours, you will have 48/480 minutes that the data is on, i.e., 10% of the time. Turning off data completely to save 10% is not very much.

I would personally set the times to disable 10minutes after screen off, and 30minutes for sync. That way LeanData isn't constantly toggling data on/off all day while you are using WhatsApp, but will toggle it off when you actually aren't using the phone, like when you go out of lunch, or go to sleep at night.

Thanks for the concern. I will be adding buttons to the notification and/or a widget to toggle it on and off, but like I said above, generally you shouldn't have to worry about turning data off completely, or fiddling with the app. This is meant to be simple/no thought given!

Agreed, we don't want to be doing things manually.
[Android Apps and Games] paul c:
Running 1.30, wifi getting stuck "turning on"... no longer happens ;)

Here is a screenshot from earlier in the day, I left the phone alone on wifi to see how it behaved - every 10 minutes or so it wakes up and does its thing.

I also checked its behaviour when I left my wifi, it still switches on wifi and ends up syncing via mobile data - and when I return to wifi, it wakes up and syncs over wifi.

So, looks like this issue is resolved :good: thanks Flyview!
[Android Apps and Games] Flyview:
Awesome, I hope it's not too early to tell. Please update to the latest 1.3.2, I made even further enhancements.
[Android Apps and Games] Bwangster12:
Running the latest version of LeanData from the Play Store on my Paranoid Android ROM on the Verizon LG G2. Everything has been fine and then this morning my alarm clock didn't go off. Got a notification that said Missed Alarm. Would LeanData have interfered with that? Never had a problem prior to running LeanData.
[Android Apps and Games] Flyview:
Nope, I don't see how. Did your phone reboot right before the alarm?
[Android Apps and Games] WhiteEVO:
My alarm has worked with every version of leandata.
[Android Apps and Games] Bwangster12:
Hmm... no, not that I know of. I had it on my wireless charger all night and when I woke up, my phone was on and looked to be fine... other than the missed alarm.
[Android Apps and Games] Flyview:
AFAIK, it means the alarm just kept ringing until it gave up :P I remember someone at work laughing at his phone saying he woke up to a "missed alarm" notification on his Nexus 5.
[Android Apps and Games] Bwangster12:
I can't imagine the alarm went off and I didn't hear it. It went off a few days since I've been on this ROM and it woke me up. As soon as I turned on LeanData, the next day I didn't hear the alarm? I don't know.
[Android Apps and Games] Flyview:
Unless your alarm clock somehow requires an active internet connection, I don't think LeanData could in any way have interfered with your alarm.

Test it out a few more times.
[Android Apps and Games] jayinc11:
Not sure how I would cause that. Just wanting to have a working app, I got no need to cause such nor do I know how. I am an enthusiast.

Here is the error level log, thanx for your attention.
[Android Apps and Games] Flyview:
Haha I meant, make sure you are making the app crash before taking the logcat, since I wasn't seeing any errors. I wasn't saying you were somehow intentionally making it crash :P

Ok, that's better. Now I see some useful info.
[Android Apps and Games] Bwangster12:
Does anyone use Hangouts as their SMS app? I assume theres at least a few...

When I get a picture, I get the message that the image didn't download (presumably cause there was no internet connection). It says I can go in and redownload it by tapping, but it doesn't seem to download right away.
[Android Apps and Games] Flyview:
I know my data automatically turns on to download MMS, even if I have manually switched it off, at least in the app I use for SMS, Textra. That may not be the case on all ROMs.
[Android Apps and Games] Bwangster12:
Yeah, it's definitely not happening with Paranoid Android on the LG G2 for Verizon, using Hangouts. I get the MMS, I see the notification I have a text, but when I go in, it tells me to tap to redownload. When I do that, it doesn't seem to ever download.
[Android Apps and Games] Flyview:
Can you test the following:

1) Turn screen on

2) Turn your data off

3) Send yourself an MMS (or get a friend to)

4) See what happens with the picture being downloaded or not
[Android Apps and Games] Bwangster12:
So, same result as when Data is On with LeanData running.

"Couldn't download MMS. Touch to download again. Size: 31kb. Expires 5/20, 4:00pm"
[Android Apps and Games] Flyview:
Right, so this has nothing to do with LeanData. It only turns off connections when the screen is off. Basically, you can't receive MMS when your data is off. Makes sense?

Hangouts *SHOULD* however download when you click "touch to download again".
[Android Apps and Games] Bwangster12:
Yeah, and that is definitely not happening after I turn Data back on and touch it again.
[Android Apps and Games] Flyview:
Hey sorry I missed your response. Can you try un-checking the exceptions to make sure it's not one of those stopping LD from disabling?
[Android Apps and Games] cuteness_overload:
I have a couple of questions/feature requests:

Would it be possible to include a very basic log (like in the good ol' juice defender? ;) ) to see when the interfaces get enabled and disabled again? And/Or it would be great to also see the notification on the lockscreen with information about when the last update has been (and the next one is scheduled for)

Over how many seconds is the network traffic sampled? Would it be possible to make this configurable?

When the connections are reactivated: Does the app first wait for an interface to connect? Or does it just enable them, wait for x seconds and disable them again (if there is no traffic detected)

Would it be possible to implement a simple "put device into flight mode from xx:xx to xx:xx". This would be really great :)

About the ConnectivityService: I tried unbouncing the wakelock (which gets rid of the 1m uptime for each update) .. and so far I (surprisingly) haven't noticed any adverse effects :) :good:
[Android Apps and Games] TNSMANI:
What is the limit you set for ConnectivityService? With this limit, are you able to locate your device in Android Device Manager?
[Android Apps and Games] cuteness_overload:
Well, I can access it and make it ring and stuff ;) However, for some reason I can't get the location of the device!

"Enabling" ConnectivityService doesn't change this though (I've set the limit to 1 day ..)
[Android Apps and Games] TNSMANI:
OT (sorry)

Limiting ConnectivityService will affect the device locating service. Perhaps, after removing the limit, if you restart the device, it may start working.
[Android Apps and Games] Flyview:
Hey sorry I missed this again, I'm not sure why XDA Labs isn't sending me notifications.

I can send you a debugging version if you really want, email me. That spits out a bunch of info into CatLog. Very few people would find a log useful so I'd rather spend my time on other things than building it into the app.

Some different info on the notification I could do. Right now it shows what it's set to disable and how long total it's disabled stuff for, since the last 100% charge.

Network traffic would be the average from screen off until it comes time to disable connections. If the exceptions stops connections from being disabled, then it's calculated from this point until the next time it tries to disable.

When it restores connections, LD doesn't care if they connect or not. It only disables them again on screen off.

Anything's possible, but I'd have to reorganize the way the app is laid out for it to make sense.

What's this about unbouncing the wakelock? How do you do that?
[Android Apps and Games] Michiel0211:
Hey Fly, [MENTION=2584205]Flyview[/MENTION]

First of all, I love LeanDroid. Can you explain something to me? I think its a bug maybe.

I have LD to periodically enable data. It does this every 20 minutes for 60 seconds.

I have LD set to enable data upon screen unlock.

Somehow, when I turn the screen on (arriving at lockscreen) it enables data already directly. Super annoying!

The funny thing is.. it doesnt do this if I recently used my phone (turned the screen on, unlocked it, checked a message), and it doesnt do this when charging. Which leads me to believe it has something to do with doze. Because if I have recently used my phone doze is not on. And if I'm charing, doze is not on.

Could I be on the right track? Aggressive doze in Greenify is off. Nothing is being blocked in Amplify and powernap has Android System and Leandroid whitelisted.

Leandroid and Android system are also whitelisted in the Battery Optimization as 'Not optimized'.

Perhaps I should test with doze off or do you think it is something else unrelated to doze?

I'm on OxygenOS 3, rooted. A oneplus X.

Hope you can help!
[Android Apps and Games] Flyview:
There's 2 things that might be happening.

Either you're using a third party lock screen which LD can't detect, or doze is actually preventing the periodic restores and they come in late with the screen on event. I don't think it's a third party lock screen because then this would be a problem all the time. From my experience doze will slow the periodic restore to about once an hour, even though I've set the wakelock to be allowed during idle aka doze.

It could also be an interaction with many of the other optimization apps you have installed!
[Android Apps and Games] Michiel0211:
I will test tomorrow what happens if I uninstall everything except LD.

You're right about the lockscreen, it's to infrequent for that. I can almost sense it happening when I have not touched my phone for an hour or so: so it has to be doze. It's almost like its thinking: OH, we have a periodic wake in the queue, lets fire it now screen on has kicked the phone out of doze.

If it can't be fixed I'll just live with it.

Can doze be turned off? Or would that hurt me badly? I dont think doze is THAT useful if the same effect can be reached with powernap (where I can properly whitelist LD). For some reason, whitelisting LD in Battery Optimization is not a FULL whitelist. Which seems to hurt the periodic functionality as you describe.

I'll keep you posted!
[Android Apps and Games] Flyview:
Yea the Android battery optimization whitelist is really only for network calls and being able to launch after a long time of not opening the app if I remember correctly.

As long as Doze is allowing LD and all other apps to wake up at the same time for periodic restores they should get along fine, it just might not happen as often as you set.
[Android Apps and Games] Michiel0211:
Yeah the frequency is not really the issue.

It's the fact that sometimes I just want to turn my phone on to see if I have messages without turning on the data and data pops on because doze is being turned off and somehow it kicks my data into gear (as if its trying to play catch up.

I noticed Android System was Optimized (thought I did that) so I set it to Not Optimized. Maybe that'll help. LD is using the connectivityservice for switching, right?
[Android Apps and Games] Flyview:
Nope, it does it's own thing. Yea but if it's catching up its not really doing any extra connects so what's wrong with that?
[Android Apps and Games] Michiel0211:
Really?! I've been going about this all wrong then.

I have no idea why its doing that then. Maybe it senses it's 'near' a scheduled periodic data enable and it moves it up to right now, since I turned the screen on. Does it have that functionality?

Yeah nothing really wrong with it I guess, I just found it odd behaviour - since I'm clearly telling it not to turn on data unless I unlock. :)
[Android Apps and Games] Lodochkin:
Thank you, it works!
[Android Apps and Games] Michiel0211:
I came back to report that using Boeffla Doze Control application to completely kill Doze fixed my weird behavior.

I am falling back on PowerNap, Greenify and Amplify completely and moving on without Doze. Worked wonders in Android 5, I don't see why it should be any different in 6.
[Android Apps and Games] Rakuu:
Having an issue with the wifi exclusion list, data and wifi still turn off if I'm on a network that's meant to stop it from doing that, this has happened across two phones and multiple rooms, Android 5 and 7. I would've reported this sooner but I just found this thread.
[Android Apps and Games] Flyview:
Hey, glad you found it, but in the future you can also email contact@teqtic.com for support!

The WiFi exclusion list will only stop WiFi from being disabled, not data. Could you post/send me some screenshots of how you have it set up? Please try removing the exclusion, adding it again, and re-testing.
[Android Apps and Games] Rakuu:
As you can see I have the option enabled, I have networks set to stop wifi from being disabled, and I am connected to one of the networks. The problem is wifi still is disabled. I've removed it and re added it, reinstalled the app, tried on two different phones on lollipop and nougat and this always happened.
[Android Apps and Games] kos25k:
hello!newby to this app..does it have an option like gravitybox smartradio?i want 3g to be switched only when i enable mobile data.all the other time i just want to go automatically to 2g for low radiation.thanks.
[Android Apps and Games] Flyview:
So I just tested this and it is still working fine for me. Are you sure your system isn't disabling WiFi? Could you please check the setting under Settings -> WiFi -> Settings OR Advanced (menu option) -> Keep WiFi on during sleep. It should be set to "always".
[Android Apps and Games] Rakuu:
Yep, it's on. It doesn't happen when I'm charging as per the setting to disable leandroid while I'm charging.
[Android Apps and Games] bkkzak:
I'm getting the same problem with wifi (and bluetooth but let's tackle wifi first); could it be because my kernel management app is set to prevent "wlan wakelock", "wlan_ctrl wakelock", and "wlan_rx wakelock"?
[Android Apps and Games] cuteness_overload:
Well I think that is far too imprecise! Imagine that you're downloading something with high speed when the screen goes off which is done after one minute. If LD then tries to disable the connection 2 minutes after the screen went off, this traffic still "matters" - although it has long been finished!

How much time does LD keep the connection then until it tries to disable it again?

Well I think this might be a valuable improvement: When LD enables the connection regularly, you should want to minimize the "connected" time, since this is when all hell breaks lose cpu load-wise, as all apps want to update their status. Most of the time, 10-15 seconds is enough (e.g. to get new messages) .. however, you obviously can't select such a short timespan in LD, since connecting can take quite a long time.

So it would be cool if LD 1) enables the interfaces 2) gets notified when a connection has been established (or disables the interfaces if the device can't connect after a specifiable timespan) 3) only "counts" the time *after* this event for deciding when to disable the interfaces again.

I think the most popular way is by using Amplify (an Xposed module) .. You should try it out - it's great :)

One last question: Where does the LeanData.DataService wakelock come from? Is it from the traffic watching ..?
[Android Apps and Games] Rakuu:
I'm going to test with this, I'll let you know.
[Android Apps and Games] Rakuu:
I turned them all back on(enabled in EXKM) and this still occured so..
[Android Apps and Games] Flyview:
I'm not sure why I can't reproduce it! The exception is working fine for me. As soon as I add it to the list, it doesn't disable it, if I remove it from the list, it disables it. Can you please check if your WiFi is remaining connected with LD turned off?
[Android Apps and Games] Flyview:
It all depends on what your turn-off interval is set to. What is yours at? If you have it set at say 15min, yes an initial big transfer would affect the average and might make LD keep connections on for the next 15min when it'll check again. If I stop doing it this way, I'd have to set another wakeup alarm about 5min before the turn off time (if the turn off interval is longer than 5min) and start counting data traffic from that point forward to the turn off point. With the way some streaming apps work, this might not even be enough. Sometimes they will download an entire song at a time (rather than continuously streaming) so if the song is 7min long, LD will have disable internet when it shouldn't have! See where I'm going with this? What do you suggest?

For your second point about time with connections on during a "periodic restore" (aka sync), I don't think it would make much of a difference. I believe it already counts the time chosen after an internet connection has been made. You can set the value to a minimum of 30s, but I can remove this limitation if you really want.

I don't use Xposed, never have and don't really wanna mess with it.

The DataService wakelock would include any wakelocks needed by LD to function. It doesn't need to keep the phone on to check data transfer, since it can check how much total transfer there is at any given point and find the difference and divide by time.

UPDATE

I have noticed using the "Switch network mode" feature is causing an ANR in the service and so LD isn't actually doing anything since it's crashing . This is on my personal device Nexus 5x with Android 7.1.1. I'm not sure when this started being a problem but I'm working on a fix.
[Android Apps and Games] Rakuu:
It seems to do this intermittently, sometimes it does sometimes it doesn't, I honestly have no idea.
[Android Apps and Games] Flyview:
Ok I think I figured it out guys. Are you guys on the free version? I can't believe I missed such a huge bug, but some options that used to be premium and are now free are not actually being set for the free users (even though the UI allows the change). Update is coming ASAP.
[Android Apps and Games] Rakuu:
Sounds like the case! Glad I could help find it.
[Android Apps and Games] Flyview:
Alright guys, a sweet new update is out on the Play store and XDA Labs, changelog below:

3.3.0 (December 30, 2016)

-Add specific time exception for cellular radio

-Fixed some options not working in free version

-Fixed GPS status no longer being read, more reliable method to determine when GPS is being used

-PLEASE GRANT LOCATION PERMISSION if you were using "except if GPS active"

-Updated UI with cardview

-Updated contact email

-Updated libsuperuser

-Built for Android 7.1.1
[Android Apps and Games] guyderam:
just a question,.. If i were to untick disable cellular data and tick switch to 2g/3g instead will till automatically switch to 2g/3g upon screen off? If if tick disable cellular data, that means data will be off after the time limit and syncing will occur only every 60mins? And there wont be any push notifications rite?
[Android Apps and Games] Michiel0211:
Hey Flyview,

Just wanted to come back to you and let you know what the issue was.

I disabled doze and that seemed to do the trick, but for some reason Android 6 does not like it when doze is disabled. I started disabling apps one by one and then I got to thinking:

ITS GREENIFY!

Greenify has a XPOSED feature called: Wake Time Coalescing - it queues wakes and fires them in bunches. Disabling this feature in Greenify fixed the problem and now LeanDroid works as intended when it is whitelisted in Battery Optimization and PowerNap.

Hope this helps other people when they google the problem.
[Android Apps and Games] Flyview:
Yes.