Device always awake while GPS tracking is enabled
The GPS tracking feature is keeping my phone in an always awake state, which doesn't allow the CPU to ever go to sleep while tracking is enabled. Please see the attached screenshots below. This causes an extra drain on the battery, and of course equipment life.
I am not experienced in Android programming, but I believe surely there must be some other way to be woken up asynchronously at a specified time, by some alarm or timer event... I was able to find a couple of links with some information on the matter, and I believe some suggestions:
I took a cursory glance at the code. I noticed in GpsTrailerGpsStrategy.java that you're acquiring the wake lock for GPS, and you do something called intentTimer.sleepUntil(nextSignificantEvent), probably in an attempt to sleep the CPU. However, it seems to not be working as expected (or at least as I thought it would).
Could you please try to take a look at this? I really like your application, but don't want to prevent the CPU from entering the low power sleep state 24/7 just to save some GPS points every few minutes...
Usage details: notice a 10h wake time, which was the amount of time I left the GPS tracking enabled. Actual GPS use was 10% of this, 53 minutes.

Battery usage graph: notice the steep fall in battery charge while the device is awake, when compared to before I enabled GPS tracking.

Thanks for looking into the code. Actually there was a couple of bugs around where you were looking which probably causes this issue. Surprisingly it is probably also occuring for everyone (including me), but wasn't mentioned before.
Basically, IntentTimer was supposed to release the wake lock when sleepUntil() is called. However, this was commented out, so it never released it.
Also, in GpsStrategy, it was waiting twice as long as it should if gps was not turned on (still with the wake lock acquired, and powering the cpu).
I fixed both of these issues. However, it's quite curious as to why this code was commented out. It's so far back in history that I don't even have commit messages for why it was done. I have a suspicion I was just trying hacks out and it accidentally got into the committed code.
In addition, I added a new option in setting, "Enable wake lock log". This option will make the TTT write to a log file "/sdcard/ttt_wake_lock_debug.txt" whenever it turns the wake lock on or off (along with a timestamp).
If this issue still occurs, please turn this option on, so I can verify whether the code is properly turning the wake lock on and off at the appropriate times. If it is, then I'll have to look deeper into why the CPU is still being used.
The new version will be v1.21 and you can monitor it here, if you use f-droid. The build number will be 65:
https://f-droid.org/wiki/index.php?title=com.rareventure.gps2/lastbuild&redirect=no
If you are using the Google Play version it should be up in a couple of hours.
Thanks again for taking such a detailed look at this problem, it really helped a lot.
@redfish64 Actually, I do not see the same pattern. I checked the battery usage sometime and I did not find anything really unusual. Here is a screenshot of my app which I used for about half hour. My GPS was set to somewhere 50-60% of the time ON. My trend seems to be fine.
However having said that, maybe I would observe it at the end of the day. I will keep that in mind and check back.
Could it be that if the GPS signal is not found, it aggressively keeps the CPU on?
@redfish64: Thank you for the quick response and code fix. I did my best to help, after all I'm also interested in having the best possible app :)
I am using F-Droid, version 1.20. I will look for the new build and install it when it comes out.
Incidentally, I should have provided my system details: this is a OnePlus 2, running OxygenOS 2.2.1 (Android 5.1.1). It's curious that @collectorgeneral doesn't see the issue on his phone, I wonder why that is... But it certainly affects mine :)
@israel-lugo @redfish64
At first I did not observe it, as the screenshot tells you. However I went on to my work and checked back a few hours later... and I do observe something odd.
Seems like @redfish64 found the issue, I will make sure to report back!

F-Droid has the new version out. I tested it out, and seems like you fixed the issue @redfish64 !
Kudos for fixing it fast! :)
@israel-lugo Can you confirm if it is fixed for you too?
@collectorgeneral I noticed it came out and installed it, but it's late at night and I've been home for several hours... I will try it all day tomorrow and report back :)
It's much better now :-) I had tracking on during the day, and the device was only awake while it looked for GPS signal. Thank you, @redfish64!
One can see in the attached file that it was really active during the afternoon, but that's because I was in a basement without GPS reception and TTT had to wait for the timeout and retry a lot. Once I disabled the GPS, things were better as TTT didn't have to wait for the timeout before giving up. Hint hint, issue #49 ;-)

I've been testing this further. The wake is much better than originally, however there is still some strange behavior. Especially when the GPS is turned off.
I tried tracking with the GPS turned off, thinking it should spend the less amount of battery. My reasoning was "I can turn GPS off when I reach work, and turn it back on when I leave".
However, there was a strange pattern with sometimes up to 20 minutes of wait time. The strange pattern starts around 12h, which was when I turned GPS off and tracking on. This was a few days ago and I'm not sure of the exact times, or if I had GPS off 100% of the time, but I think so, at least most of the time I did. Please note the attached screenshots for the pattern and duration of wake vs actual GPS use.
I am also attaching the ttt_wake_lock_debug.txt file.

Found another issue and fixed. Will be in v1.1.22, build 66. See README for more