yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] okij:
How exactly did you set up tasker to do this? I tried the following, but am not happy with it, as it isn't working for my purposes:

Tasker profile: If variable %GPS = on, then send intent com.suyashsrijan.forcedoze.DISABLE_FORCEDOZE

Tasker profile: If variable %GPS = off, then send intent com.suyashsrijan.forcedoze.ENABLE_FORCEDOZE

The reason I'm not happy is that I keep the system setting for Location enabled at all times (i.e. "Location" and "High Accuracy" settings are enabled), which doesn't mean that actually the GPS receiver is enabled at all times. It is is only enabled (and shown in the notification bar) when an app like Google Maps or GPS Recorder is actually using it.

So my problem is that Tasker looks at the system setting for variable %GPS and not if the GPS receiver / hardware is actually running.

How do I set this up properly with GPS receiver as trigger?

---

[MENTION=5427507]ssrij[/MENTION]: Yesterday evening I installed the current Version 1.3.5 rev 39. The Doze Battery stats now seem to be logged properly. In the options I currently just have enabled "Turn off while charging" and "Show persistent notification".

However, this morning I saw that during the rest of the night there again wasn't any maintenance window, but Doze mode kept running continuously for about 6,5 hour. How can this be? Or is this OK because it doesn't have any negative side effect anyway?

Should the occuring maintenance windows be visible in the Doze Battery stats? There wasn't any entry in the Doze Battery stats, but I also checked the full log by searching for "maintenance" and didn't find it.

---------- Post added at 02:19 PM ---------- Previous post was at 02:16 PM ----------

I second that. It would be great if the Xposed option would stay in the app as an alternative.
[Android Apps and Games] Arstoien:
[MENTION=4916555]okij[/MENTION] just add app context to the profile you already have. If you, for example, add Maps there, then the profile would be activating only when both the app is in foreground and the GPS is on (in the settings).

Sent from my Nexus 5
[Android Apps and Games] ianmacd:
1.3.5 rev 39 isn't working well for me, I'm afraid. It's properly entering Doze, but not staying there. Any motion whatsoever is bringing the device straight out of Doze.

I biked around for about half an hour this afternoon. The device kept entering Doze for between 15 to 30 seconds and then coming out again. It must have dozed 50 times in 30 minutes, but never for more than half a minute. I lost 10% of battery in those 30 minutes.

I can't send a debug log, because the log has no entries older than the last 60 seconds. I'm not sure why this is the case, but the phenomenon started before 1.3.5.

I had made a back-up of 1.3.4 rev 38 just in case I might need to revert to motion sensor disabling if there was a problem with the new implementation of aggressive doze, but accidentally overwrote it with a back-up of rev 39. :(

Reluctantly, I'm reverting to Greenify's aggressive doze for the time being. :crying:
[Android Apps and Games] okij:
Thanks for your quick reply, but actually I rather don't want to have this app-dependend, but just dependend on the GPS receiver, as [MENTION=5655810]noisyriver[/MENTION] wrote.

I'm also not sure if a check if the app is in the foreground would help, because GPS tracking apps are supposed to run in the background. So if I e.g. start a track recording in Geo Tracker and then - while recording the track - use my email app, I don't want to have to remember to bring Geo Tracker back in the foreground before turning off the screen again. All should just work automatically without a hassle. :)
[Android Apps and Games] okij:
I attached ForceDoze_1.3.4_rev_38.apk to this post, which I I fetched out of my Titanium backup. I hope that this is OK for [MENTION=5427507]ssrij[/MENTION], otherwise I will remove the file again.
[Android Apps and Games] noisyriver:
I only use the GPS sensor, no Google Location Service etc. Therefore enabling Location is for me enabling GPS and your Tasker profile works for me. For you I would propose to add an app context, as [MENTION=4928198]Arstoien[/MENTION] said.
[Android Apps and Games] ianmacd:
Thank you very much!

I had temporarily switched over to Naptime (instead of Greenify), but I'd much rather run ForceDoze.

I'm back in business now on rev 38 until the problem with motion detection can be fixed.
[Android Apps and Games] noisyriver:
Beside that I added a custom quick tile with this app: https://play.google.com/store/apps/details?id=com.quinny898.app.customquicksettings&hl=de which which runs a task in Tasker to turn FD on or off from notification center. I let Tasker show a notification when FD is of so that I see and remember when it's turned off.

Maybe this would be a wish [MENTION=635976]ssr[/MENTION]ji to add something like this direktly to the app.
[Android Apps and Games] Arstoien:
When the GPS app is running it should have a persistent notification. You can have Tasker monitor for that instead. There's a free Tasker plugin called Notification Listener you can use. Alternatively, you can install an app like GPS Status, which can create a notification every time the GPS is being used, but that wouldn't be a method I'd recommend.

Sent from my Nexus 5
[Android Apps and Games] ssrij:
They're not meant to be removed, so you cannot remove it otherwise your device will stop functioning during Doze.
[Android Apps and Games] ssrij:
After adding the app, what happens when you go back and open Whitelist again? Do you see the new app?
[Android Apps and Games] ianmacd:
Following up on myself here, I installed 1.3.5 rev 39 on my tablet and observed similar behaviour to the phone, but with one perhaps significant difference.

As with the phone, I finished using the device and the screen turned off. I immediately picked up the tablet, went outside and then biked with it in my bag.

During the period I was biking, the device repeatedly entered Doze and came out of it again mere seconds later, presumably due to the constant motion while biking. This is the same behaviour I observed on my phone.

However, after arriving at my destination, the tablet was left motionless on a table for an hour. During this time, it entered Doze and stayed there.

At the end of the hour, I picked it up again and biked home. Here's the perhaps significant detail: During this ride home, the device remained in Doze and didn't come out again until I arrived home, opened the cover and the screen turned on. I suspect my phone would have shown the same behaviour, had I not been using it while at my destination.

It's almost as if the device can't reach full idle state if the device is in constant motion as soon as the screen turns off, but I doubt this is actually the case. Greenify reports Doze being reached over and over again, always between 15 - 30 seconds at a time.

I've put the tablet back on 1.3.4 rev 38 in the meantime.
[Android Apps and Games] ssrij:
Cell Standby is taking a lot of battery. That's because you're in an area where the signal strength changes a lot.
[Android Apps and Games] Sheikh Nadeem:
No.. Its empty.
[Android Apps and Games] ssrij:
Thank you for testing. I'm looking into this now, I will try using AlarmManager to create my own delay and set it to 5 minutes during movement, so it won't constantly enter but only every 5 minutes.
[Android Apps and Games] ssrij:
Have you gone to System Settings - Battery - Battery optimisation and checked if the app you added is whitelisted there or not, or whether it shows apps that are whitelisted.

Also, send me a log
[Android Apps and Games] ssrij:
That will probably not work, once the screen goes off, FD will not have any opportunity to do any pre-Doze work and to put your device into force-idle mode. You will have to add the 5 min delay to ForceDoze, rather than Tasker.

Why do you want ForceDoze to request accessibility permissions?
[Android Apps and Games] ssrij:
Pushed a new update (1.3.5 rev 40) to Play Store (but feel free to grab the APK)

ForceDozeService: ForceDoze will now try to put the device into Doze every 15 mins during movement using AlarmManager (so no wakelocks required).

This should fix the battery drain issue some are facing.
[Android Apps and Games] ssrij:
I am trying to figure out why that happens. The logic for logging maintenance events is quite simple. If the screen is off & the current Idle state is IDLE_MAINTENANCE, then it logs an event (Exiting Doze to do maintenance jobs) and then if the screen is off & the current Idle state is IDLE & the previous state was IDLE_MAINTENANCE, then it logs another event (Entering Doze after doing maintenance jobs).

Now, it also checks if either WiFi or mobile data was disabled or not, so perhaps you haven't turned on the setting to disable mobile data or WiFi? That could be one reason.
[Android Apps and Games] rcherif38:
Hey man

Apparently we all love your work and appreciate your effort very much

But please don't make us all test new versions

Keep stable versions like v1.3.1 rev 32 which was working very good with no major issues

And upload test builds for some people to test

Because not everyone have the opportunity to test all the time in my opinion.

It's just a suggestion and the decision is yours

With all my respect

Thanks in advance
[Android Apps and Games] ssrij:
I agree, I'll be rolling out a beta program with the next version so people in that channel will be the first ones to test a new change. Although rolling it out to the masses has allowed me to get feedback much quicker. Most people who use the app aren't interacting with me or the rest of the people here in this XDA thread, so the only way to reach out to them (or for them to reach out to me) is email/Play Store reviews.
[Android Apps and Games] Ygor Cortes:
After enabling ForceDoze my device doesn't lock automatically anymore. If I don't press the power button to lock my phone, when I wake it up again it will bypass the lockscreen. Is this the normal behaviour?
[Android Apps and Games] ssrij:
That is because your lockscreen timeout is higher than Immediately. There is two ways to fix this:

Set your Lockscreen timeout to Immediately in System Settings -> Lockscreen

Uncheck Ignore lockscreen timeout in the app's Settings (this will make the app use a wakelock of the same length as the lockscreen timeout to keep itself awake until the timeout passes, then your device will be put into Doze)

I would recommend doing the 1st option, the 2nd one can have an impact on battery life, especially when your lockscreen timeout is high (2 mins or above).
[Android Apps and Games] okij:
I'm sorry to say this, but I also have a very bad battery experience with rev 39, see attached screenshot.

At night, with no movement and on WiFi, I have literally no battery drain.

Then this afternoon, being on 2G and moving constantly in an area where I normally have 1% battery drain per hour, now I had 5%. In GSam Battery Monitor graph you can see that Doze turned on and off like crazy.

I'm not sure if setting it to 5 or 15 minutes during movement will really help that much, at least in comparison to the more efficient Xposed implementation that was removed in rev 39.

So I vote again for putting the Xposed functionality for ignoring the sensors in Doze back into ForceDoze, as it is the most efficient way when rooted and using Xposed! Please! :)

Thanks for looking into my issue!

You are right, I use neither the setting for disabling WiFi nor mobile data (even though I asked for that feature), since I barely have battery drain on WiFi (as you can see on my battery graph) and decided use Smart Network for switching from LTE to 2G when the screen is off, rather than turning mobile data off completely.

So turning on the FD setting for e.g. turning off mobile data could serve as a workaround?

Could you then also implement a real fix for this bug, if your theory is right?

Thanks again for your hard work! And good luck for tonights football match England vs Russia, if you're into football! :)
[Android Apps and Games] ssrij:
Let me know if the new 15 min delay helps or not. Otherwise, I'll revert everything back to how it was in rev 38.

It should. I'll just make a small change so it checks for those settings separately

PS: Not into football!
[Android Apps and Games] Ishaan Gupta:
The xposed version was great. Now my phone hardly stays on doze when I am moving with my phone.
[Android Apps and Games] okij:
OK, I'll start testing now, but I fear that it won't be as good as the Xposed method, since movement will have too much impact. I guess it will rather behave like standard Doze.

Great! :)

That's good, otherwise we would't have too many updates during the next 4 weeks. ;)
[Android Apps and Games] ssrij:
Let me know how the new version performs (1.3.5 rev 40)
[Android Apps and Games] ianmacd:
I'm going out in half an hour to pick up my children, so I can test rev 40 then.

I'm already thinking, though, 'How could this change be an improvement?'

If I understand the change correctly, the likely course of events is that my device will go into Doze when I leave the house, wake up again 15 - 30 seconds later and then stay awake until put to sleep again 15 minutes later; after which the cycle will repeat. Perhaps I don't understand the change correctly.

Regarding rev 38 vs. 39, I do personally feel that this was too invasive and radical a change to introduce in one fell swoop with no in-app ability to fall back to the old behaviour. On the other hand, I respect that it's your app and your judgement to make. This is just one user's opinion and it's the only development decision I have thus far seen that has caused me to raise my eyebrows.

The pre-rev 39 behaviour was rock solid for me. Even if this new AD implementation were apparently working as intended for me, I'd still favour keeping the old method as an option in the app, because firstly, choice is good and secondly, the old code is so well tested at this point and known to be solid.

The same applies to the Xposed module, which was also working well for a lot of users (although not for me the last time I tried it).
[Android Apps and Games] Arstoien:
Thanks for the answer. I was just thinking accessibility permissions would not allow the system to stop the service and thus not require a wakelock. Another question. If the device is in force-idle mode, it doesn't come out in case of movement, is that correct? If that is the case I could achieve what I'm looking for just in Tasker alone.

Sent from my Nexus 5
[Android Apps and Games] ssrij:
I will have to look into it in Android docs if that's really the case

Whether is comes out of Doze on movement or not totally depends on your configuration of ForceDoze settings
[Android Apps and Games] ssrij:
Pushed a new update (1.3.6 rev 41) to Play Store (but feel free to grab the APK)

ForceDozeService: REVERTED previous changes made to ForceDozeService regarding sensor enable/disable. Your previous configuration will automatically be restored. The changes made led to some users experience battery drain, so I have now reverted the changes and made it optional, just like it was before
[Android Apps and Games] Arstoien:
I don't know whether that is the case for sure but alternatively you can use the persistent notification to protect the service from being killed. So the user would have an option – keep persistent notification or wakelock.

Sent from my Nexus 5
[Android Apps and Games] ssrij:
The app already uses a persistent notification by default, but that still affects Timers/Handlers, which is what the app used before transitioning to wakelocks.
[Android Apps and Games] ssrij:
Well, ForceDoze schedules a wakeup for 15 minutes after your device exits Doze due to movement. Once your device exits out of Doze on movement, it will stay out of Doze for an hour at least because that's what the default Doze wait time is. The 15 min scheduled wakeup will ensure that the device goes back into Doze if it's not

significantly moving

, because maybe your device goes out of Doze because you picked up the phone and then kept it on a stable surface. Normally, if that happened, your device will wait for 1 hour before going into Doze. Now, it will only wait for 15 mins. On the other hand, I am not entirely sure why your device kept checking for significant movement every 15-30 secs, that seems like a bug in the OS or the deviceidle service, because checking so often can drain battery life.

It was only done to gather some data, which I have now. Apologies for trouble

I have just pushed a new update that reverts the changes back to pre-39 version.
[Android Apps and Games] milojoseph:
I'm glad I follow this thread did not know option 2 cause battery drain.
[Android Apps and Games] The_Voice_70:
One Question:

Maybe German Translation interesting for you ? ;)
[Android Apps and Games] ssrij:
The app will give you a warning if it detects your lockscreen timeout is high
[Android Apps and Games] ssrij:
You can fork the project on GitHub, translate the strings to German (English strings can be found in /res/values/strings.xml, after translating to German, you'll have to put the translated strings in /res/values-de/strings.xml) and send a pull request so I can review.
[Android Apps and Games] The_Voice_70:
Allright... understand;) Thanks for quick response.
[Android Apps and Games] ianmacd:
OK, so then I hadn't correctly understood what the rev 40 change would bring. Thank you for explaining it in more detail.

I've just returned from an hour of cycling around Amsterdam and the behaviour I witnessed surprised me until I read the above. Now that I understand what the 15 minute wake-up actually does, the behaviour I saw while biking is consistent with this.

For the record, my device entered Doze upon screen-off as normal and, as I had seen earlier today, was woken by motion within the first minute.

This time, however, it never entered Doze again on its own. If I stopped biking, turned on the screen, and then put it back into my bag, the cycle would repeat: Doze within a minute, exiting Doze again within the next minute, and then not re-entering Doze again. This is consistent with "Once your device exits out of Doze on movement, it will stay out of Doze for an hour at least".

Cheers. I'm happy to continue to try out any new ideas you might come up with for improving the AD algorithm, but I agree with a previous user who wrote that the main branch should be kept free of compulsory experimentation.

Thank you for your continued dedication to this project, and your equally dedicated support of it here on XDA.
[Android Apps and Games] ssrij:
If you guys don't like to wait for many hours to get Play Store update, clearing Play Store cache (Applications -> Google Play store -> Clear Cache) and checking for updates again shows the new update immediately.
[Android Apps and Games] ianmacd:
They're actually coming through very fast at the moment.

By the time I had read your last reply to me on this thread, 1.3.6 was already waiting for me in the Play Store.

Thanks for the tip, though. That's good to know.
[Android Apps and Games] Ygor Cortes:
It looks like Ambient Display is now working even with the sensors disabled... this is AMAZING! Thank you a lot!

---------- Post added at 09:33 PM ---------- Previous post was at 08:57 PM ----------

Sorry... my mistake. It's not working, as expected.
[Android Apps and Games] ssrij:
Yeah, you need to keep sensors enabled. I have Always On Display activated on my Galaxy S7 edge, and it works fine, even with sensors disabled.
[Android Apps and Games] Ygor Cortes:
Yeah... always on display doesn't need the sensors differently from Ambient Display.

IMO Google shouldn't even have added this motion bull**** to Doze to begin with.

I can't wait to use your app once Android N final is finally released!
[Android Apps and Games] ssrij:
I am not sure if ForceDoze will be supported on N, Google has added a new permission (android.permission.DEVICE_POWER) that apps need in order to control deviceidle. This permission is only granted to apps that are signed with the same certificate as the ROM. I will have to look into the code to see if there's another way to control deviceidle, or if it's possible to use Xposed to control it, otherwise ForceDoze will not work on N.
[Android Apps and Games] milojoseph:
I'm getting battery drain on my non rooted s7e can you tell me what to disable. I'm on the latest version
[Android Apps and Games] ssrij:
Check with GSAM if it's ForceDoze which is draining your battery (unlikely) or some other app/service (or something else like Cell Standby). Also, latest version is 1.3.6 rev 41, is that what you're on?
[Android Apps and Games] Ygor Cortes:
Oh no :(
[Android Apps and Games] ssrij:
I have made some changes to Doze battery stats today, after taking into account the feedback I have got from many users. This is what the new UI looks like:

[IMG="Doze Battery stats (new)"]http://i.imgur.com/2l1XkKol.png[/IMG]

Changes:

New UI

No seperate Enter/Exit entries, they will be combined into a "Session"

It will now show you time spent in a "Session", so it will be easier for you to see how much time your device spent in Doze

It will also show you the battery usage in a "Session", so you can see how much battery was used during a "Session"

I have added two indicators, one with a lightning sign, which indicates the battery usage during that session was within acceptable limits, and one with an alert sign, which indicates the battery usage was above acceptable limits, so you can look into GSAM or another third party battery stats app to investigate what drained your battery

This will be pushed in a new update later today
[Android Apps and Games] okij:
Quick question: Did you make this change already in rev 41?

If so, I could test tonight if my phone enters Doze maintenance windows again.

If not, I could try turning on "Disable mobile data during Doze" for tonight to see if this serves as a workaround.
[Android Apps and Games] ssrij:
Yes, I did!
[Android Apps and Games] okij:
Great! So I will leave the "Disable ... during Doze" options disabled and test if your fix works.

Nice upcoming Doze Battery stats UI change, BTW! Just a small suggestion: Maybe you could make the frames a bit more compact, so that more stats fit onto one screen.
[Android Apps and Games] ssrij:
It's not going to fit any more items, the max that you would see on average would be 3-4 and the next item would be cut off. How many items fit totally depends on your screen size. If you would like a more compact view where you can see lots of entries at a glance, I am leaving the old UI still intact, so you can switch to it from the menu to see more items if you want.
[Android Apps and Games] ssrij:
Pushed a new update (1.3.7 rev 42) to Play Store, but feel free to grab the APK

Changes:

ForceDoze: Option to sign up for ForceDoze Beta testing. Go to Menu - Settings - About ForceDoze and tap on Sign up for beta testing

Doze Battery stats: New UI and more stats! I have kept the old UI around, if you like to see a lot more stats at a glance. To access the old UI, you can go to Menu -> Compact view

Doze Battery stats: You will only be able to store and see the 100 most recent entries (50 sessions) now. This is to reduce clutter, plus old stats aren't going to be very useful

Whitelist: Ability to open the Battery optimization system activity from Whitelist. This is a workaround for people who have trouble adding/removing apps via ForceDoze
[Android Apps and Games] Ishaan Gupta:
Hey! Firstly thanks for your dedication. Forcedoze is working nicely on my device.

Forcedoze is not battery optimised by default. Should it be enabled or not? Will it affect the functionality if I enable it?
[Android Apps and Games] kryshnakishore:
1.joined as tester

2.I dnt see any option for compact view

3.again some options make me confused like sensors, Xposed etc

---------- Post added at 02:47 AM ---------- Previous post was at 02:45 AM ----------

U should not enable it, if we enable ForceDoze closes after 30 mins & we get system doze optimization.... I am not 100 % clear but we should not optimize FD
[Android Apps and Games] ssrij:
No, ForceDoze exempts itself for stability reasons.