Improve and fix the shutup service#473
Open
Mudit200408 wants to merge 2 commits into
Open
Conversation
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.
The shutup service was previously not working for me, as Indian apps like BHIM, Yono SBI, Rail one, etc.. apps are pain, but the thing was Geto used to perfectly work but I wanted just one app that can do everything. So this PR fixes all the issues. It works like a charm even if you are not launching the app from shortcut and you have the "Shutup Services" Enabled. However some apps are better with the Shortcut app launch.
This implementation was tested by some other users too and it was working perfectly for them too.
Some of the implementation is inspired from GETO...
Changes (AI Generated):
Hybrid Polling & Sync: Transitioned from purely depending on accessibility package events to a dedicated background monitoring thread in ShutUpForegroundService that queries UsageStatsManager events every 400ms for robust foreground app detection.
Continuous Foreground Re-enforcement: Instead of applying settings just once upon app launch, the foreground service now re-applies/re-enforces the Shut-Up settings every 2 seconds while the target app remains in focus. This prevents target apps from dynamically detecting developer settings if they check again after startup.
3-Second Debounced Revert: When leaving a targeted app, the service runs a background debounced check for 3 seconds (pendingRestoreJob). It continuously verifies if the app is truly closed/stopped in the background before restoring original system settings.
Multi-App Collision Prevention: When multiple Shut-Up apps are running consecutively, the service intelligently skips restoring developer options/USB debugging if a new targeted app has already taken the foreground, keeping the system continuously secured.