feat:3399: replace persistent flag by recurrent wakeup timer
Description
The persistent flag allows the OS to trigger the rescue party mode. Which leads to reboot the device to the recovery mode in case of several failures for the given service. Advanced Privacy is not an essential service on the device. So even if the service crashes the user should be able to continue to use his device.
Technical details
Action achieved up to there:
- remove the persistent flag
- add the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission (to allow background services, as in microG)
- add a repeating alarm each 15minutes, to wakes up A-P if it has been killed
Other idea to explore:
- set processId to systemUid
- add some monitoring to sentry, to evaluate if service is not running sometimes
Tests
After normal life use, check that Tracker blocking is still working (trying to open some blocked websites like outbrain.com).
Issues
https://gitlab.e.foundation/e/os/backlog/-/issues/3399
10 commandments of code review
Summary by CodeRabbit
-
New Features
- Added support for requesting the system to ignore battery optimizations, improving background process reliability.
- Enhanced service reliability by periodically restarting background services to keep them active.
-
Bug Fixes
- Prevented redundant restarts of tracking services, ensuring smoother operation.
- Ensured only one active background listener for certain settings, reducing potential performance issues.
-
Chores
- Updated dependencies to include AndroidX Work KTX for improved background task management.
- Improved app initialization sequence for faster and more reliable startup.