fix:3399: make trackerService a foregound service to avoid freezing.
Description
Removing persistent flag broke DNS resolution on eOS devices in certain conditions :
- on A14 and A15
- on device capable with cgroup v2 linux kernel feature (for example FP3 doesn't have, redfin has)
- after the device is quiet for a while (~1 hour? activating battery-saving android feature may speedup this move to frozen state)
Current MR follow AOSP documentation recommendation: https://source.android.com/docs/core/perf/cached-apps-freezer#handling-custom-features As a workaround, if an app has a process that needs to perform activities while cached, change the process status to non-cached (such as Bound ForeGround Service (BFGS) or foreground)
This as a consequence for the user it requires to display a notification. To transform this constraint into a feature to the user, we display the last tracker call (and dismiss it after 5 minutes):
Technical details
Tests
Before this fix, I managed to reproduce the "internet issue" with the following steps, on a redfin A15, with AdvancedPrivacy from eOS 3.1.0Beta 2
The steps I did :
- Enable in developer settings "suspend execution for cached apps" instead of ("device default")
- Activate Battery saver
- Disconnect the phone for at least 30minutes
- Then, open browser, and try to load a webpage
Issues
https://gitlab.e.foundation/e/os/backlog/-/issues/3399
10 commandments of code review
Summary by CodeRabbit
-
New Features
- Real-time tracker notifications showing app/tracker names, timestamp, icon, and whether a data leak was blocked or allowed.
- Persistent "Advanced Privacy is running" notification.
-
Localization
- Added German, Spanish, French, Italian translations for tracker notifications; US English date format added.
-
Reliability
- Tracker service now runs as a foreground service for more reliable notification delivery.
-
Permissions
- New system/exact-alarm permissions declared to support the foreground behavior.