kylecorry31 / Trail-Sense

An Android app that uses your phone's sensors to assist with wilderness treks or survival situations.
https://kylecorry.com/Trail-Sense/
MIT License
1.22k stars 74 forks source link

App begins to lag after a while of use #2579

Closed An-anonymous-coder closed 1 month ago

An-anonymous-coder commented 1 month ago

I have checked for duplicates of this issue, but did not find any. The app was installed via the APK file on the releases page (6.3.0-dev). My device is a Pixel 8 running GrapheneOS.

After using the app for a while (a couple weeks) it will begin to show significant signs of lag. The compass will not turn smoothly, no menus will scroll smoothly, etc. The only way to fix this issue is to clear the app storage, and if I import a recovery file of my settings it will begin to lag again. I have to manually reconfigure the settings instead of importing them to prevent the lagging.

There are no errors, the issue is present even with location and sensor permissions disabled, I have tried clearing the cache and resetting calibration, nothing else works but resetting the app entirely.

I don't know how to reproduce this other than to just use the app normally. I would be happy to privately provide the recovery file for my data for testing purposes.

kylecorry31 commented 1 month ago

@An-anonymous-coder hi, I have not experienced this before.

My suspicion is that you may have Backtrack always on (Settings > Paths > Backtrack) and the backtrack history set to a large number (Settings > Paths > Backtrack history) or the path marked as keep forever (Tools > Paths > there may be a path that has dates as the title, if it is temporary it will display "Temporary" in the list).

If you are fine sending the recovery file, you can email it to me at trailsense@protonmail.com

An-anonymous-coder commented 1 month ago

Hi! Thanks for the quick reply. I have never used the Backtrack feature, so it is disabled. The history setting is set to 2 days, and I don't have any paths saved. I will try to reproduce the bug using as little information as I can to protect my privacy, and I will send it over as soon as it's ready. Note that this bug has happened even without location services ever used, so it has something to do with a sensor that persists even after the sensor permission is revoked and is stored somewhere in the app storage.

An-anonymous-coder commented 1 month ago

Odd behavior: The lag managed to persist even after the app storage was cleared. Reinstalling the app fixed the issue. I will note here that it is entirely possible it is due to a faulty sensor in the device, since the device has had some rough use. This still seems to be software side, so maybe check if the app panics due to faulty hardware?

An-anonymous-coder commented 1 month ago

It seems the compass lag and scrolling lag are separate issues. Go to Settings > Sensors > Sensor Details. It will have a lag spike every time the accelerometer updates (which is faulty for me, by the way. It seems to show the force of gravity plus the current real acceleration, so 9.81 m/s^2 when the device is stationary. Accuracy is displayed as "Poor".) This doesn't solve the compass lag, but it is still a bug. The device is stationary during this recording:

https://github.com/user-attachments/assets/c0a022a7-fe29-4cf9-a187-6333ed1c40d2

An-anonymous-coder commented 1 month ago

Even more frustrating: Restoring the settings no longer produces the compass lag. This means that whatever is causing the lag is something that is only fixed via uninstalling and reinstalling the app. I hope that gives you any clues. For clarity, I will summarize the issue:

After using the app for extended periods of time during normal use (a couple weeks), the turning animation of the compass will begin to stutter. This is not fixed by clearing app cache. This is not fixed by clearing app storage. This is not fixed by resetting calibrations. It is only fixed by uninstalling and reinstalling the app. The behavior is present without location permissions, and without using the Backtrack feature. It does not manifest itself after restoring a backup of data. There is an unrelated issue where the Settings > Sensors > Sensor Details page will have a lag spike every time the accelerometer is updated.

I hope that gives you enough information to figure something out. I'll try my best to reproduce the issue and provide a recording. I'm upset that these new observations are the complete opposite of what was originally observed. I'll do some testing once it happens again to clear this up. Sorry for the confusion.

kylecorry31 commented 1 month ago

Thank you for the further information. I'm still not 100% sure what it can be.

I will say that the dev versions of the app have debug mode enabled which can cause lag that isn't present on the builds posted on F-Droid and Google Play.

Clearing storage should wipe all settings and data, so I don't think it's the accumulation of data from Trail Sense itself. Because of that, I'm leaning toward the debug build being the problem. Since I actively develop Trail Sense, I don't think I've gone more than a week without reinstalling the debug build (but have gone longer than a month with the release build without issue).

An-anonymous-coder commented 1 month ago

That explanation makes sense. I'm wondering if other causes are some libraries or the app itself using some shared system storage that persists data after a storage clear. In any case, I will try using the F-Droid version to see if I can reproduce it in a couple weeks. Is there any way you can put two builds of the APK for each release, one for dev and one for normal, since lots of users install apps via Obtainium?

An-anonymous-coder commented 1 month ago

The F-Droid version resolved the lag in the Sensor details menu, so this issue can be closed until the compass lag begins again (if ever).

Note: You can still notice a slight stutter in the Sensor Details menu.

kylecorry31 commented 1 month ago

Glad that helped.

Here's an issue to track the release build on GitHub releases: https://github.com/kylecorry31/Trail-Sense/issues/2580

As for the slight stutter on that page, that is a known issue and I will eventually fix that here: https://github.com/kylecorry31/Trail-Sense/issues/1771

(should be a lot less than the debug build though - debug builds on Android have pretty poor performance, especially on newer versions of Android for some reason)

kylecorry31 commented 1 month ago

I'm going to close this for now, but if the compass lag begins again, just let me know and I'll reopen this