feat: use foreground service to prevent accessibility services from being killed on HyperOS/Redmi#239
Draft
Copilot wants to merge 2 commits into
Draft
feat: use foreground service to prevent accessibility services from being killed on HyperOS/Redmi#239Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
- Add FOREGROUND_SERVICE and FOREGROUND_SERVICE_DATA_SYNC permissions - Add foregroundServiceType="dataSync" to AppBlockerService and UsageTrackingService manifests - Add startForegroundNotification/stopForegroundNotification helpers in BaseBlockingService - AppBlockerService (process :app_blocker_service) uses notification ID 9001 - UsageTrackingService (main process) overrides to use notification ID 9002 - Both services start foreground on connect and stop foreground on destroy - Add string resources for the foreground notification channel/title/text Agent-Logs-Url: https://github.com/nethical6/digipaws/sessions/779f9cb6-7eb7-4f21-9dca-4a76a0f2432b Co-authored-by: nethical6 <79095297+nethical6@users.noreply.github.com>
- Fix indentation of permission declarations in AndroidManifest.xml - Always attempt to create notification channel (no-op if exists, handles user deletion) - Remove unnecessary Build.VERSION_CODES.N check since minSdk is 26 Agent-Logs-Url: https://github.com/nethical6/digipaws/sessions/779f9cb6-7eb7-4f21-9dca-4a76a0f2432b Co-authored-by: nethical6 <79095297+nethical6@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
nethical6
May 4, 2026 08:56
View session
|
i cn confirm xiaomi being very aggresive |
Owner
wannabe ahh ios 🥀💔✌️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Xiaomi HyperOS/MIUI aggressively kills background processes, causing
AppBlockerServiceandUsageTrackingServiceto stop functioning. Promoting both to foreground services raises their process priority and prevents this.Changes
FOREGROUND_SERVICEandFOREGROUND_SERVICE_DATA_SYNCto the manifestandroid:foregroundServiceType="dataSync"to bothAppBlockerServiceandUsageTrackingServiceBaseBlockingService— AddedstartForegroundNotification()/stopForegroundNotification()helpers called fromonServiceConnected()/onDestroy(); exposedopen val foregroundNotificationIdso each subclass gets a distinct notification IDUsageTrackingService— OverridesforegroundNotificationId = 9002(vs. default 9001 used byAppBlockerServicein its separate:app_blocker_serviceprocess); adds missingsuper.onServiceConnected()call to trigger the base class foreground promotionIMPORTANCE_LOW, ongoing notification on a dedicatedcurbox_fg_servicechannel — minimal user-facing footprint while satisfying the foreground service contract