Skip to content

Implement MDM-controlled SMS/MMS filtering and refine permissions#5

Open
UncleAndy123 wants to merge 7 commits into
jbriones95:masterfrom
UncleAndy123:master
Open

Implement MDM-controlled SMS/MMS filtering and refine permissions#5
UncleAndy123 wants to merge 7 commits into
jbriones95:masterfrom
UncleAndy123:master

Conversation

@UncleAndy123

Copy link
Copy Markdown

Preview of MDM enforced blocklist and allowlist for SMS/MMS.

UncleAndy123 and others added 7 commits June 10, 2026 08:19
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant