Implement MDM-controlled SMS/MMS filtering and refine permissions#5
Open
UncleAndy123 wants to merge 7 commits into
Open
Implement MDM-controlled SMS/MMS filtering and refine permissions#5UncleAndy123 wants to merge 7 commits into
UncleAndy123 wants to merge 7 commits into
Conversation
…rictions - Introduced `SmsWhitelistManager` to manage message filtering based on rules pushed via `RestrictionsManager`. - Supported "whitelist", "blocklist", and "off" filtering modes using CSV-formatted phone numbers. - Integrated filtering logic into `SmsReceiver` to drop incoming SMS messages from unauthorized senders before database insertion. - Updated `MmsDownloadReceiver` to validate MMS senders against active restrictions and clean up placeholder records for blocked messages. - Implemented phone number normalization to ensure consistent comparison across various formatting styles. - Added the `RECEIVE_APP_RESTRICTIONS` permission to the manifest to support MDM-pushed configuration updates.
Merging new features from master upstream branch into UncleAndy repo.
…odernize URI handling
- Moved the MDM-based `SmsWhitelistManager` check to the beginning of `SmsReceiver.processMessage` to prevent side effects like thread creation or database insertion for unauthorized messages.
- Clarified filtering logic by distinguishing between MDM "hard-filtering" (dropping the message entirely) and local "soft-filtering" (suppressing notifications for blocked keywords or numbers).
- Updated `SmsReceiver` and `MmsDownloadReceiver` to use the `toUri()` KTX extension for more idiomatic URI parsing.
- Refactored `SmsReceiver.processMessage` and `resolveThreadId` for improved readability and consistent formatting.
- Added `@SuppressLint("UseKtx")` to `MmsDownloadReceiver.resolveThreadId` where applicable.
… defaults - Implemented MDM "hard-filtering" in `MmsDownloader` to validate senders via `SmsWhitelistManager` before the message is stored. - Added logic to delete message placeholders and trigger a conversation list refresh when an MMS is blocked by MDM policies. - Updated `Prefs` to provide default MMS proxy settings (`proxy.mobile.att.net` on port 80). - Added `MODIFY_APN_SETTINGS`, `READ_PHONE_STATE`, and `READ_APN_SETTINGS` permissions to the manifest to support APN configuration. - Modified `network_security_config.xml` to permit cleartext traffic globally, ensuring compatibility with legacy carrier MMS endpoints.
…ions - Integrated `SmsWhitelistManager` into `ThreadActivity` to validate recipients synchronously before processing outgoing messages. - Added a "Message blocked" Toast notification and ensured the composer UI (text and attachments) is preserved when a message is blocked by policy. - Removed unused APN-related permissions (`MODIFY_APN_SETTINGS`, `READ_PHONE_STATE`, `READ_APN_SETTINGS`) from the Manifest. - Hardened `network_security_config.xml` by disabling global cleartext traffic in the base configuration. - Added the `message_blocked_by_policy` string resource to support MDM filtering feedback.
- Integrated `SmsWhitelistManager` checks into the `UnifiedMessageSender` interface to enforce MDM policies across all outgoing SMS and MMS paths. - Introduced `OutgoingFilter` to centralize recipient validation and handle state transitions for blocked messages. - Updated `LegacyUnifiedMessageSender` and `LibraryUnifiedMessageSender` to abort the entire send operation if any recipient violates the active MDM policy. - Added logic to mark blocked scheduled messages as failed in the database and trigger UI refreshes via `EventBus`. - Refined phone number normalization in `SmsWhitelistManager` to better handle NANP formats, leading prefixes, and wildcard entries. - Improved logging and diagnostic output within the filtering and normalization logic.
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.
Preview of MDM enforced blocklist and allowlist for SMS/MMS.