��# Cager
Cager Cager is an Android “network lockdown” tool that can disable network (and other) subsystems on rooted devices via su commands, or on non‑rooted devices via a VPN-based packet dropper plus notification‑listener filtering. It is modular, JSON‑driven, and highly configurable.
Table of Contents Features
Architecture & Modules
Getting Started
Requirements
Clone & Build
Run on Device
Configuration & JSON Commands
Module JSONs
Whitelist
Non‑Root vs Root Behavior
Advanced Settings
Contributing
License
Features Network lockdown (disable/restore Wi‑Fi, mobile data, Bluetooth, NFC, airplane mode)
Rooted path: runs shell commands under su to disable low‑level services
Non‑root path:
VPN service that drops all packets
NotificationListenerService to suppress unwanted notifications
Do‑Not‑Disturb (DND) integration in “silent” mode
Modular JSON‑driven command loader (add/remove modules easily)
Housekeeping via WorkManager (clear caches, remind reboot)
Quick‑settings tile support (Android 7+)
Emergency broadcast receiver for remote “kill‑switch”
Architecture & Modules MainActivity
UI toggle button
Chooses “root” vs “VPN” path
Schedules periodic housekeeping
Presents advanced settings dialog
CommandRunner & ModuleLoader
Loads JSON from assets/commands/.json
Filters by user preferences
Executes disable or restore command lists
CageVpnService
Foreground VPN that simply drops all outbound packets
Cleans up on revoke/stop to remove notification
NotificationHandlerService
Listens for posted notifications
Applies “full”, “icon”, or “silent” suppression
Respects user whitelist
HousekeeperWorker
Periodic WorkManager job to clear old notifications, caches, and post a maintenance reminder
QuickTileService
(API 24+) Quick‑settings tile to toggle Cager
EmergencyReceiver
Listens for custom broadcast com.example.cager.EMERGENCY_CAGE to immediately cage
Getting Started Requirements Android API 21+
(Optional) Rooted device for full native commands
Android Studio (recommended)
Clone & Build bash Copy Edit git clone https://github.com/Gosheto1234/Cager.git cd Cager
import into Android Studio or:
./gradlew assembleDebug Run on Device Install the APK on your device/emulator.
Grant POST_NOTIFICATIONS when prompted (Android 13+).
If non‑root: grant Notification access under Cager in Settings › Notification access.
Toggle “Enable Cage” to start lockdown.
Configuration & JSON Commands All subsystem–specific commands live under app/src/main/assets/commands/.json. Each JSON has two arrays:
json Copy Edit { "id": "radios", "disable": [ "svc wifi disable", "svc data disable", "svc bluetooth disable", "svc nfc disable" ], "restore": [ "svc wifi enable", "svc data enable", "svc bluetooth enable", "svc nfc enable" ] } Module JSONs net: iptables rules, routing
radios: Wi‑Fi, data, Bluetooth, NFC via svc
airplane: settings commands for airplane mode
usb: disable USB (e.g. svc usb setFunctions none)
sync: cmd notification, cmd alarm, drop caches
apps: pm disable‑user / pm enable
sensors: appops/camera/location
extras: fstrim, jobScheduler, caches
Enable or disable each module in Advanced Settings.
Whitelist For rooted path, you can whitelist UIDs (or package names) so network is still allowed for those apps. Stored in SharedPreferences under key whitelist.
Non‑Root vs Root Behavior Path Network block Notifications DND integration Root Shell commands under su Root service notification n/a (you see root‑mode note) Non‑root VPN service drops packets NotificationListener “silent” style engages DND
On uncage, we stop the VPN service (removing its notification) and call NotificationManagerCompat.cancelAll() to clear any leftover icons.
Advanced Settings In the settings dialog you can:
Toggle each module on/off
Disable ASCII loader animation
Manage whitelist
Choose notification style:
full: normal notifications
icon: suppress text/details (currently same as silent)
silent: drop all notifications and engage DND
Enable/disable battery‑guard (skip heavy commands if <15% battery)
See “Rooted: yes/no” status
Contributing Fork the repo
Create a branch (git checkout -b feature/...)
Make your changes (follow existing style)
Update or add JSON modules under assets/commands
Add tests or manual verification steps if applicable
Submit a pull request
License This project is licensed under the MIT License. See LICENSE for details.
0 commit comments