yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] ssrij:
Did some digging.

It's essentially a logging issue, and not that your phone is not exiting Doze. There's not much code that is executed when you turn on your screen. Currently, one of two things happen:

Screen ON broadcast received -> isDeviceDozing() = true -> exitDoze() -> Put a new entry in Log

Screen ON broadcast received -> isDeviceDozing() = false -> cancel enterDoze() timer (if the timer is running then it means ForceDoze hasn't put your device into Doze mode due to Doze Delay/lockscreen timeout and Ignore Lockscreen Timeout set to false)

The logic is, when you turn on the screen, your device is still in Doze mode (the docs for deviceidle says unless you manually pull the phone out of force idle mode, it will remain in Doze) so the app checks whether the phone is in Doze mode or not, and exits Doze mode if it is. Now, what I believe is happening is that, on some devices, the phone exits Doze mode on screen on automatically, hence causing isDeviceDozing() = false, and thus preventing the service from calling exitDoze(). Normally, it would only be false if ForceDoze hasn't put your device into Doze mode due to Doze Delay/lockscreen timeout and Ignore Lockscreen Timeout set to false. But I guess isDeviceDozing() = false on some devices due to the device exiting Doze mode on its own on screen on.

The problem is, I can't always assume isDeviceDozing() = false on screen on and call exitDoze() because that may lead to certain issues. Anyhow, I am going to push a new update to the beta channel so people can test the effects of exiting Doze regardless of whether the device is already in Doze mode or not. If all works fine, I'll push the changes to the stable build.
[Android Apps and Games] kryshnakishore:
pls do check it

---------- Post added at 08:03 PM ---------- Previous post was at 08:01 PM ----------

and thus
[Android Apps and Games] ssrij:
I don't see a problem. Your phone had the screen turned on, that's why it was "Awake". For the rest of the time, your phone was in charging, that's why it was "Awake". In between, there was a small period of sleep, because your screen wasn't on and your phone wasn't charging. Your phone will obviously not go into Doze if you have your screen turned on or if your phone is charging. If you want it to go into Doze even when your phone is charging, you need to disable Turn off while charging in Settings. Even if you do that, if you have the screen turned on, your phone will not go into Doze (obviously makes no sense to go into Doze when the screen is on).

TL;DR: Your phone is Awake because your screen was on the whole time (and also because you were charging your phone). What's the problem here?
[Android Apps and Games] okij:
Thanks for your digging and explanations!

However, I'm not sure that it's just a logging issue, since - as I wrote here this morning - I also experienced that my phone entered a Doze maintenance window, but never exited it. This lead to WiFi still being turned on when I switched on the screen for the first time this morning, while it actually should have been turned off again at the end of the Doze maintenance window (which obviously didn't happen).

So on the one hand there's the possibly wrong logging, on the other hand there is the not-entering and -exiting Doze mode that occurs quite often on my phone and is clearly visible by e.g. WiFi or mobile data not being turned off respectively on.

But of course I will try your new beta when it's out. :)
[Android Apps and Games] ssrij:
This is what happened (according to your logcat):

07:26:38: Device exited Doze for maintenance

07:27:34: Screen ON received

You turned on your screen 1 minute after it exited the maintenance window (which usually lasts a couple of minutes). Hence, the missing entry and your WiFi being on.
[Android Apps and Games] ianmacd:
Really? That's the exact opposite of how I thought it worked.

You obviously know more about this than I do, so I believe everything you say, but what then typically causes a device (i.e. one without ForceDoze) to ever leave idle state when the user starts to use it again?
[Android Apps and Games] Arstoien:
Let me just ask this, so I'm sure I understand: So realistically, at the moment there's no way to delay Doze after screen off without wakelock? Both "ignore lockscreen timeout" checked with "Doze delay" and "ignore lockscreen timeout" UNchecked cause wakelocks?

Sent from my Nexus 5
[Android Apps and Games] ssrij:
Screen on, which is ignored if force-idle mode is on (see here). Movement also plays a role, but if access to motion sensors is disabled, then it'll stay in Doze.
[Android Apps and Games] ssrij:
There is a way to delay Doze (probably by increasing INACTIVE_TIMEOUT), but there isn't a way to delay ForceDoze itself. I've tried a lot of ways but using a partial wake-lock is the most reliable way to delay ForceDoze.
[Android Apps and Games] ianmacd:
Here's some oddness:

[IMG="Notification tray"]http://s33.postimg.org/t2ala657z/img_1465391120451.jpg[/IMG]

Firstly, there's the time of the ForceDoze notification: 02:26. Should that never be updated?

Then there's the fact that ForceDoze seems to not have noticed the most recent three Doze sessions. They must have happened, because Greenify has logged them, but ForceDoze is somehow failing to log them.

Finally, I have deduced from these timestamps that ForceDoze isn't ignoring motion detection. My device is coming out of Doze every time I get up and go somewhere. This is using 1.3.3 rev 35, the Xposed module and Disable motion sensing for Doze.

I had the impression that motion detection was working until very recently, but it's possible I wasn't paying great attention to the timestamps; or just wasn't moving much on those days!
[Android Apps and Games] okij:
Hm, this might be true for the logcat from this morning. However, the behaviour tonight with v34 was that the last entry in the Doze battery stats said "Entered Doze for maintenance" at about 2 a.m. and I turned the device on at about 6:45 a.m., with WiFi still being active. So either ForceDoze missed some more subsequent "Exited Doze for maintenance" and "Entered Doze for maintenance", ore something else is still going wrong.

I'll attach a screenshot of the current Doze battery stats screen (I'll have to edit this message to do this) which only shows "Entered Doze mode ..." for the last 9 occurences.
[Android Apps and Games] ssrij:
The Xposed Module is experimental. I would need access to recent logs after the usage of the app to identify what's going on. Haven't had a chance to improve it because of lack of logs

Have you checked Doze battery stats and compared the timestamps with Greenify's?
[Android Apps and Games] ianmacd:
OK. I was failing to notice/understand the force- part of force-idle, so I thought you were saying that a screen-on event wouldn't bring a device out of normal idle state (as opposed to one forced by ForceDoze). That's what made me think I must not have understood anything about how Doze works. :)

---------- Post added at 18:09 ---------- Previous post was at 17:58 ----------

Yes, sorry about this. I no longer have the relevant log, due to a reboot this afternoon.

I have just done this. It seems that ForceDoze is logging all of the entries into Doze, but not all of the exits from it. There are sections of the battery stats where I have three or four Entered Doze entries with no corresponding exit entries.

These missed exits seem to correspond with the device coming out of Doze due to a failure to ignore motion detection, but this may be entirely coincidental.
[Android Apps and Games] colonel_lp:
Hi,

I have checked a few times now, and each time when I turn on the phone it says that it has been dozing, and that is before the battery has reached 100%. Was there nothing in the logs I posted? If not, any way I can help to debug this?
[Android Apps and Games] Arstoien:
Isn't it possible to somehow use your implementation of xposed (disabling motion sensors for Doze only) with the default Doze? I.e. waiting for inactive_to to run out, then essentially SENSING state will not stop the operation, since the sensors won't report any movement, and going in Doze as desired?

Sent from my Nexus 5
[Android Apps and Games] ssrij:
Yeah it can be, but for that to work first, I would first need to fix any issues with the implementation of the module first. Then you can perhaps keep the ForceDoze service disabled, but keep the module activated
[Android Apps and Games] ssrij:
Nope. Can you confirm if all of these are true:

You've reinstalled the app

You connect your phone to a charger before the screen turns off and your battery is less than 100% and your phone enters Doze after the screen turns off

You connect your phone to a charger after the screen turns off and your battery is less than 100% and your phone enters Doze (or stays in Doze)

You have Turn off while charging enabled in Settings

Also, how are you verifying whether your device stays in Doze? If your device is actively in Doze while your screen is on, apps will throw error and you won't be able to use the Internet.
[Android Apps and Games] ssrij:
I explained about this earlier. Now, failure to ignore motion detection is another thing, probably being caused by using the Xposed module. I can look into it once you provide a recent log after using the app/Xposed module for some time.
[Android Apps and Games] kryshnakishore:
1.something is going wrong ,uninstalled force doze app rebooted.when I charge my phone with screen turned off & all apps killed I see charge bar & awake bar are same .I mean when I charge it is awaking

2.installed force doze latest version ,enabled FC ,disable WiFi&mobile data, no sensors to awake ,enabled doze while charging,ignore lockscren timeout enabled......still i see its awaking while charing

see screen shot below ,ignore 'screen on' as I know when 'screen on' then awake bar is also on....what is making to awake even when screen off with force doze enabled

screen shot : https://mega.nz/#!X0tijBAb!5ekDlcnfn78nV9q3ld2iBmrwnkh2cVs4ka-993aMBGE

log ; https://mega.nz/#!W00AlQha!KC0xbqs4Y_jCbugrF6xXTtEVsAp8tbnIWb_id_EXcxo

log cat: https://mega.nz/#!mx80BYQZ!sHKHDv0i0dxQmsBA5goRnD3P9-kTNccIURDYr59jfGM
[Android Apps and Games] ianmacd:
OK. Just to be clear, do you mean the Xposed log, FD's debug log or both?
[Android Apps and Games] ssrij:
I guess you didn't properly read what I said earlier. Your phone is "awake" because it's charging. "Awake" means the CPU is active and not in sleep. It's illogical to put the CPU to sleep while the phone is charging, because the phone is getting a constant supply of power, hence the system does not have to worry about losing battery and therefore it makes sense to keep the CPU out of sleep so your phone can be ready to use any time and also continue to receive notifications.

Do you understand now?
[Android Apps and Games] ssrij:
Both
[Android Apps and Games] kryshnakishore:
Thanks for patience, Got it, clarified well
[Android Apps and Games] colonel_lp:
Hi. Yes to all of the above.

I plugged in the charger at 6.58pm with the screen on, I had been using browser before and it was working fine on internet, you can see that it enters doze at 6.59:45pm and exits when I turned the screen on.

The total doze time shown is near the time the screen has been off. My example was only short as I don't have time now, but I've noted this behaviour for a while on longer charges.

For some reason some exit doze times are not being shown, as reported by another user, but the phone had definitely exited doze, I also use the greenify doze notification to monitor doze (yes greenify aggressive doze is turned off)

xperia Z3 d6603 | RSXW mm
[Android Apps and Games] bluedog220:
Hey great app very neat idea! I'm running a Nexus 5 rooted on RR ROM . When I use the app ans choose to disable mobile data when entering doze it doesn't turn back on when turning on the phone . Any ideas what I could do to fix this ?
[Android Apps and Games] ssrij:
Thanks, that's really strange and shouldn't be happening. Unfortunately I cannot replicate this issue here, so it's a little hard to find the exact cause of this, but I'll keep looking.
[Android Apps and Games] bluedog220:
I hope that worked. If not I can try again!!
[Android Apps and Games] ssrij:
Nope, it's the Xposed log and only contains entries related to Xposed and the modules.
[Android Apps and Games] ssrij:
I have pushed a small update that makes the app more accurate when it comes to querying the current Doze state. Previously, I was querying it by using the official API, but it seems like it's not accurate enough, so I now query deviceidle directly, to get the most accurate result. Querying directly also allows me to check for all possible states, so for example I can now more reliably check whether the device is in maintenance mode or not. This change should make logging a little more accurate.

Let me know if it improves the situation where there are some missing EXIT log entries.
[Android Apps and Games] GigaSPX:
On the Galaxy S7 Edge with Verizon, complete stock and unrooted. I made a donation to the app for its greatness in Marshmallow, and I have the latest update today. I noticed that Disabling Wi-Fi during Doze works, but not the same as Mobile Data. It seems to require SU binary or simply root to work. Is there a workaround being able to use ADB to make it work instead? Thanks
[Android Apps and Games] reycharlesconrad:
Hi. Is this also suppose to address a problem wherein sometimes the app wouldn't restore the wifi state to ON when screen is on? My experience is a hit and miss. Sometimes it will restore my wifi but most of the times it won't when I turn the screen on. However, it doesn't fail to turn it off during screen off. I hope you can advise me what I can check to have this working properly. Thanks a lot for your app :)
[Android Apps and Games] ssrij:
Unfortunately no, you still root even if the app is granted READ_PHONE_STATE permission. Previously there were ways to turn it on without root, but Google has hidden those APIs now, and even if you use other methods to use the hidden APIs, the permission that is required to access it is only granted to apps signed with the same certificate as system apps.
[Android Apps and Games] ssrij:
Only one way to find out!
[Android Apps and Games] pinoholo:
Even i tick option to turn off while charging, mobile data still being turned off by app when screen off. Can you make mobile data on while screen off when connect to charger?
[Android Apps and Games] ssrij:
Can you toggle the Turn off while charging option and toggle the ForceDoze switch in the app, and check if it still happens or not?
[Android Apps and Games] David_D36:
After getting this app I expected a drastic improvement in battery life. Even though it has helped a lot, for some reason my battery life is still not on par with other galaxy note 5 devices. With 10% left, my screen has used a total of 50% of my battery, however, it says screen has only used around 500mah. Since the note 5 has a battery of 3000 mah, shouldn't screen take 1500mah? Sorry if this is not the right section to post this.
[Android Apps and Games] Pupet_Master:
Amazing app, how ever i have one problem.

Wifi and data don't turn back on after screen get back on
[Android Apps and Games] pinoholo:
It work, mobile data works while charge.

But then another problem appears, mobile data won't turn on when screen goes on. I have to manually switched it on

Here's the log from app
[Android Apps and Games] okij:
I'm sorry to say this, but rev 36 still doesn't work properly. :(

On the attached screenshot of the Doze battery stats you can see that the last "Exited Doze mode" (which should correspond to the "Entered Doze mode at 7:08:24") is missing.

Furthermore, the Doze battery stats show no "Exited Doze for maintenance" and "Entered Doze for maintenance".

I attached the app log and a full logcat to this post.
[Android Apps and Games] ps89:
Hello, [MENTION=5427507]ssrij[/MENTION]. My phone sometimes fails to enter Doze after it's restarted. I have the 'Disable motion sensing for Doze' option enabled. However, I saw the line below in Xposed's logs.

ForceDozeXposed: usePermanentDoze: false, useXposedSensorWorkaround: false, serviceEnabled: false.

Can you please help to look into it?

Thanks. :)
[Android Apps and Games] android_htc:
Hello [MENTION=5427507]ssrij[/MENTION],

I am not sure why but my debug log and xposed logs are empty. I am on the latest update on my note 4. Also I've had a huge battery drain last night. See attached screen shots. Thanks for your support.
[Android Apps and Games] colonel_lp:
It seems that if I toggle the force doze service off and on while plugged in, the phone won't doze while charging. I noticed this before but just thought i hadn't waited long enough as it didn't stick after reboot. Will see if time or reboot returns to same behaviour.

xperia Z3 d6603 | RSXW mm
[Android Apps and Games] dobermann24:
Great APP, can i use this whit powernap, greenify and naptime ?

APP dont reactivate wifi and data after screen off. I cant disable notification.
[Android Apps and Games] ianmacd:
As long as you use Greenify only for hibernation (and not for Aggressive Doze), it won't conflict.

The other two are messier, because you would have to be very careful how you configure them to avoid unexpected and unwanted interactions.
[Android Apps and Games] noisyriver:
I use it with Powernap and in fact if I deactivate one of both I get a slightly higher standby drain (1,5 % with none of them, 1,1 % with one of them, 0,8 % with both). I found no issues, at least none where I think it's because of Powernap. Of course you have tho whitelist Powernap in FD and FD in Powernap...

If you use Naptime only for editing the doze parameters there also should be no problem.
[Android Apps and Games] dobermann24:
okay than i test it :)
[Android Apps and Games] doiutzu:
Hi

I had problems on previous versions with exiting doze. First it didn't restart auto brightness and rotation. Than, after you introduced wifi and data toggle it didn't enable them at screen on.

I updated today to rev 36 and now it works like a charm [emoji3] [emoji3] [emoji3]
[Android Apps and Games] noisyriver:
Does anybody else has the issue that the device don't leave the doze modus for maintenance windows when checked the option to disable Wi-Fi and mobile data

during doze? Therefore also my Email won't sync anymore regularly. When disabling this option everything is fine.
[Android Apps and Games] smatak:
[MENTION=5427507]ssrij[/MENTION]

Hello,

I installed the latest version (1.3.3 rev36) but I still facing problem, like many versions ago.

Sometimes i cannot wake up my phone and i need to pull out the battery.

I have LG G3 with fulmics rom and i don't use xposed.
[Android Apps and Games] ssrij:
Turn on 'Dont disable sensors on screen off'
[Android Apps and Games] smatak:
Thanks for fast reply :) I will try it :)

So it means, that the phone will not be in doze mode in pocket during walking or only another sensors can works (e.g.light sensor)?
[Android Apps and Games] ssrij:
Yes, it will exit Doze during significant movement. There's no workaround for it on LG devices, unless you use the Xposed module.
[Android Apps and Games] kryshnakishore:
Great improvements day by day.

Suggestion for notification in status bar

1.time spent

2.battery % of enter doze & exit doze

3.i guess we can remove currently dozing which always shows false & last screen off too can be removed (if enter/exit doze % is shown)
[Android Apps and Games] noisyriver:
[MENTION=5427507]ssrij[/MENTION]

Sorry if ask this again, but I cannot imagine that I am the only one having this issue:

If I setup FD to disable Wi-Fi and Network during doze it won't never leave doze until I turn on the device. This means simply no maintenance windows anymore. It doesn't doze, it's in deep sleep... ;)

Tested this over night where it stays 7 hours in doze without waking up and over day where it stays over 90 min in doze. See image here. Checked with latest release (36) too. FD log shows no maintenance windows, GSAM too and I don't receive any mail, whatsapp etc. anymore until I switch the device on.

As soon as I disable the options to disable Wi-Fi and network everything is fine.

I also disabled every other app (Powernap e. g.) that could interfere.

Am I really the only one facing this issue?

CM 13 on a Note 4 btw.
[Android Apps and Games] colonel_lp:
I have noticed in wakelock detector that, today for instance, out of 5hrs since unplugged, with hardly any use, Force doze has a CPU wakelock if 1.5hrs.. is this a problem? Dozing appears to have been working normally.

xperia Z3 d6603 | RSXW mm
[Android Apps and Games] ssrij:
The app will only create a wake lock if (1) Ignore lockscreen timeout is turned off and you have a lockscreen timeout higher than Immediately (2) Doze delay is turned on
[Android Apps and Games] ssrij:
That is because the Xposed module failed to prevent Doze from using the motion sensor. You should deactivate it now, it's experimental anyway.

The persistent notification can easily be disabled from the app's Settings, you have to toggle the switch in the app for the changes to take effect
[Android Apps and Games] ssrij:
Perhaps the system decides not to leave Doze mode because the WiFi and mobile data is disabled, thus nullifying the point of leaving Doze to sync because there isn't any Internet available. I'll have to look into the OS code to see if this is device-specific or a general behavior
[Android Apps and Games] ssrij:
Did you change any settings in the app, apart from the one related to WiFi/mobile data?
[Android Apps and Games] darkwolf_99:
It seems rev36 has different versions because MD5 seems different time to time.:confused:
[Android Apps and Games] ssrij:
Did you by chance turn on 'Don't disable sensors on screen off" ?
[Android Apps and Games] ssrij:
They don't provide much info. You should use a third party app like GSAM to figure out what exactly is draining your battery overnight. Battery drain isn't related to ForceDoze because it doesn't do anything that would drain your battery, apart from creating temporary wake locks when you have (1) Doze Delay turned on, OR (2) Ignore lockscreen timeout turned off and lockscreen timeout is set to a value higher than Immediately. Even then, the wake lock is removed once the delay (Doze Delay/lockscreen timeout) passes.
[Android Apps and Games] ssrij:
Can you confirm the following paths have the correct permission granted (using something like Root Explorer):

Path: /data/data/com.suyashsrijan.forcedoze/shared_prefs/com.suyashsrijan.forcedoze_preferences.xml Permission: rw-rw-r-- (0644)

Path: /data/data/com.suyashsrijan.forcedoze/shared_prefs Permission: rwxr-xr-x (0755)

Also, is SELinux set to Enforcing mode or Permissive?
[Android Apps and Games] ssrij:
Probably a calculation error
[Android Apps and Games] ssrij:
It works fine, you just happened to turn on the screen when the Idle state was changing.

07:19:53.777 15084 15084 I ForceDozeService: Screen ON received

07:19:53.777 15084 15084 I ForceDozeService: Last known Doze state: INACTIVE

07:19:53.891 15084 15084 I ForceDozeService: Current Doze state: IDLE_PENDING

Coming to maintenance windows, perhaps the system decides not to leave Doze mode because the WiFi and mobile data is disabled, because there's no point to leave Doze to sync apps because there isn't any Internet available. I'll have to look into the OS code to see if this is device-specific or a general behavior, and adjust the setting's description accordingly.
[Android Apps and Games] ps89:
Hello, [MENTION=5427507]ssrij[/MENTION], I managed to make it work by disabling the 'Disable motion sensing for Doze' option, restarting my phone, enabling the 'Disable motion sensing for Doze' option and restarting my phone.

Now the log reads:

ForceDozeXposed: usePermanentDoze: false, useXposedSensorWorkaround: true, serviceEnabled: true.

Thanks. :)