### BootReceiver - Root Mode Re-application Logic Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Example of re-applying firewall rules in Root mode after a reboot. This involves enabling chain-3 and then disabling networking for previously active packages. ```kotlin // Re-apply example (Root mode, internally): val rootExecutor = RootShellExecutor() rootExecutor.exec("cmd connectivity set-chain3-enabled true") for (pkg in activePackages) { rootExecutor.exec("cmd connectivity set-package-networking-enabled false $pkg") } ``` -------------------------------- ### WhitelistFilter.compute() for Whitelist Mode Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Computes the lists of packages to allow and block in WHITELIST mode. Iterates installed packages, respecting system-app visibility. ```kotlin val selectedPkgs = listOf("com.myapp.trusted1", "com.myapp.trusted2") val showSystemApps = false val result: WhitelistFilter.WhitelistResult = WhitelistFilter.compute(context, selectedPkgs, showSystemApps) // result.toAllow — packages to explicitly set networking=true (the whitelist) // result.toBlock — packages to set networking=false (everything else with INTERNET permission) println("Allow: ${result.toAllow}") // [com.myapp.trusted1, com.myapp.trusted2] println("Block: ${result.toBlock}") // [com.twitter.android, com.instagram.android, ...] // Apply results executor.exec("cmd connectivity set-chain3-enabled true") for (pkg in result.toBlock) { executor.exec("cmd connectivity set-package-networking-enabled false $pkg") } for (pkg in result.toAllow) { executor.exec("cmd connectivity set-package-networking-enabled true $pkg") } ``` -------------------------------- ### Control FloatingButtonService Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Start or stop the floating button service. The service is enabled via SharedPreferences and auto-starts on firewall enable or boot completion if enabled. ```kotlin // Start / stop the floating button service FloatingButtonService.start(context) // startForegroundService on API 26+ FloatingButtonService.stop(context) // stopService // The floating button is enabled via SharedPreferences: prefs.edit().putBoolean(FloatingButtonService.KEY_FLOATING_BUTTON_ENABLED, true).apply() // Icon color reflects firewall state: // Active (blocking) → green (#4CAF50) // Inactive → grey (#BDBDBD) // The service auto-starts on firewall enable if KEY_FLOATING_BUTTON_ENABLED == true // and also on BOOT_COMPLETED if KEY_FLOATING_BUTTON_ENABLED == true ``` -------------------------------- ### PersistentDaemonManager Lifecycle and Operations Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Manages the on-device background daemon for accepting shell commands over TCP. Handles installation, status checks, command execution, and log retrieval. ```kotlin val manager = PersistentDaemonManager(context) // Install (or reinstall) the daemon — copies assets, pushes via LADB, starts process val installed: Boolean = manager.installDaemon { progressMessage -> Log.d("Daemon", progressMessage) // "Copying assets..." // "Connecting to LADB..." // "Starting daemon..." // "Daemon is running!" } // Check whether daemon process is accepting connections (non-blocking, 500 ms connect timeout) val running: Boolean = manager.isDaemonRunning() // Send a raw command and receive the response string val response: String = manager.executeCommand("cmd connectivity set-chain3-enabled true") // "Command finished with exit code 0" // Verify daemon is alive and responding to ping val healthy: Boolean = manager.healthCheck() // Internally: executeCommand("ping") == "pong" // Force-regenerate auth token (call this when reinstalling the daemon) val newToken: String = manager.regenerateToken() // Fetch last N lines from the daemon log on the device val logs: String? = manager.readRecentDaemonLogs(maxLines = 20) // "/data/local/tmp/daemon.log" tail output, or null if LADB not connected ``` -------------------------------- ### Selecting and Executing Shell Commands Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Demonstrates how to select the appropriate ShellExecutor based on context and execute a shell command. Includes error handling for failed commands. ```kotlin // Select executor based on saved working mode val executor: ShellExecutor = ShellExecutorProvider.forContext(context) // Run a connectivity command through the active backend val result: ShellResult = executor.exec("cmd connectivity set-chain3-enabled true") if (result.success) { // chain3 is enabled } else { Log.e("TAG", "Error: ${result.stderr}") } ``` -------------------------------- ### FirewallUtils: Checking Backend Readiness Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Explains how to check if the configured firewall backend is operational. Optionally displays a toast message upon failure. ```kotlin // Check that the configured backend is ready (shows toast on failure if showToast=true) val ready: Boolean = FirewallUtils.checkBackendReady(context, showToast = true) // For ROOT: calls RootShellExecutor.hasRootAccess() // For LADB: calls PersistentDaemonManager.isDaemonRunning() // For SHIZUKU: checks Shizuku.pingBinder() + Shizuku.checkSelfPermission() ``` -------------------------------- ### FirewallUtils: Loading Active Packages Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Shows how to load the set of packages that are currently being actively blocked by the firewall, which is a subset of the selected applications. ```kotlin // Load currently actively-blocked packages (subset of selectedApps that chain3 is actually blocking) val active: Set = FirewallUtils.loadActivePackages(prefs) ``` -------------------------------- ### FirewallTileService - onClick Behavior Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Describes the behavior of the Quick Settings firewall tile when clicked. It either disables the firewall or enables it based on the current state, resolving target packages as needed. ```kotlin // onClick() behavior: // - If enabled → calls disableFirewall(activePackages) → set-chain3-enabled false // - If disabled → resolves target packages per current FirewallMode, // then calls enableFirewall(packages, whitelistAllowApps) ``` -------------------------------- ### Daemon Launch Script Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt The script used to deploy and execute the ShizuWall daemon process on the device via LibADB. ```bash # Deployed to /data/local/tmp/daemon.sh and run via LADB: nohup env CLASSPATH="/data/local/tmp/daemon.dex" /system/bin/app_process /system/bin \ com.arslan.shizuwall.daemon.SystemDaemon >> /data/local/tmp/daemon.log 2>&1 & ``` -------------------------------- ### FirewallUtils: Saving Firewall State Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Demonstrates how to persist the firewall's enabled state and the set of actively blocked packages. Saving the enabled state also notifies relevant services. ```kotlin // Persist enabled state and notify widget + ScreenLockMonitorService FirewallUtils.saveFirewallEnabled(context, prefs, enabled = true) // Persist the set of actively blocked packages FirewallUtils.saveActivePackages(prefs, setOf("com.twitter.android")) ``` -------------------------------- ### Unblock App Network Access with Chain 3 Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Use this command to allow a specific application to access the network again. Replace 'com.example.targetapp' with the actual package name. ```bash cmd connectivity set-package-networking-enabled true com.example.targetapp ``` -------------------------------- ### Enable Firewall with ADB Broadcast Source: https://github.com/ahmetcanarslan/shizuwall/blob/main/README.md Use this command to enable the firewall for saved selected apps. Ensure Shizuku, ADB, or Root is active. ```bash adb shell am broadcast -a shizuwall.CONTROL -n com.arslan.shizuwall/.receivers.FirewallControlReceiver --ez state true ``` -------------------------------- ### RootShellExecutor Usage Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Shows how to use the RootShellExecutor for commands requiring root access. Includes checking for root access availability. ```kotlin // Root backend — wraps `su -c ` val rootExecutor = RootShellExecutor() val hasRoot = RootShellExecutor.hasRootAccess() // companion fn, runs `su -c id` val r = rootExecutor.exec("cmd connectivity set-package-networking-enabled false com.example.app") // r.exitCode == 0 on success ``` -------------------------------- ### FirewallTileService - Accessibility Service Auto-Enable Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Demonstrates how the Firewall tile service automatically enables the accessibility service for SMART_FOREGROUND or FOCUS_TRACKER modes if it's not already running. ```kotlin // For SMART_FOREGROUND / FOCUS_TRACKER modes, the tile auto-enables the accessibility service: if (!ForegroundDetectionService.isServiceEnabled(context)) { ForegroundDetectionService.enableServiceViaShell(context) } // Then calls: set-chain3-enabled true (no per-app blocks; service handles them dynamically) ``` -------------------------------- ### Enable Android Chain 3 Firewall Framework Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt This command must be run before blocking any specific app. It enables the firewall framework at the system level. ```bash cmd connectivity set-chain3-enabled true ``` -------------------------------- ### Block App Network Access with Chain 3 Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Use this command to prevent a specific application from accessing the network. Replace 'com.example.targetapp' with the actual package name. ```bash cmd connectivity set-package-networking-enabled false com.example.targetapp ``` -------------------------------- ### FirewallUtils: Loading Firewall State Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Provides functions to load the firewall's enabled state and the list of selected applications from SharedPreferences. Includes validation against device reboots. ```kotlin val prefs = context.getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE) // Read persisted enabled state — also validates that elapsedRealtime hasn't reset (i.e. no reboot) val isOn: Boolean = FirewallUtils.loadFirewallEnabled(prefs) // Load the user-selected app list, filtering out ShizuWall itself and any Shizuku packages val selectedApps: List = FirewallUtils.loadSelectedApps(context, prefs) // e.g. ["com.twitter.android", "com.instagram.android"] ``` -------------------------------- ### Define Product Flavors in Gradle Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Configure product flavors in app/build.gradle.kts to differentiate builds, such as including or excluding daemon support. This affects the output APK naming and build commands. ```kotlin // app/build.gradle.kts flavorDimensions += "version" productFlavors { create("full") { dimension = "version" buildConfigField("boolean", "HAS_DAEMON", "true") // includes LibADB + BouncyCastle } create("fdroid") { dimension = "version" versionNameSuffix = "-fdroid" buildConfigField("boolean", "HAS_DAEMON", "false") // Shizuku / Root only } } // Output APK naming: ShizuWall-4.5-release.apk // Build commands: // ./gradlew assembleFullRelease # Google Play / GitHub Releases // ./gradlew assembleFdroidRelease # F-Droid (no proprietary LibADB deps) // Compile the daemon DEX manually (full flavor only): // 1. Edit scripts/compile_daemon.sh → set SDK_PATH, BUILD_TOOLS_VER, PLATFORM_VER // 2. chmod +x scripts/compile_daemon.sh && ./scripts/compile_daemon.sh // Output: app/src/main/assets/daemon.bin ``` -------------------------------- ### Build Release APK Source: https://github.com/ahmetcanarslan/shizuwall/blob/main/README.md Use this Gradle command to assemble a release version of the ShizuWall application. ```bash ./gradlew assembleRelease ``` -------------------------------- ### Enable Firewall for Specific Apps via ADB Broadcast Source: https://github.com/ahmetcanarslan/shizuwall/blob/main/README.md Enable the firewall for a specific list of apps using a CSV package string. Ensure Shizuku, ADB, or Root is active. ```bash adb shell am broadcast -a shizuwall.CONTROL -n com.arslan.shizuwall/.receivers.FirewallControlReceiver --ez state true --es apps "com.example.app1,com.example.app2" ``` -------------------------------- ### Enable Firewall via ADB Broadcast (Specific Apps) Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt This ADB command enables the ShizuWall firewall for a specific list of applications provided as a CSV string. Ensure one of the supported backends (Shizuku, LADB, Root) is active. ```bash adb shell am broadcast \ -a shizuwall.CONTROL \ -n com.arslan.shizuwall/.receivers.FirewallControlReceiver \ --ez state true \ --es apps "com.example.app1,com.example.app2" ``` -------------------------------- ### Reading SharedPreferences in Kotlin Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Demonstrates how to access SharedPreferences to retrieve values for working mode and selected applications. Provides default values if keys are not found. ```kotlin val prefs = context.getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE) val mode = WorkingMode.fromName(prefs.getString(MainActivity.KEY_WORKING_MODE, "SHIZUKU")) val selected = prefs.getStringSet(MainActivity.KEY_SELECTED_APPS, emptySet()) ?: emptySet() ``` -------------------------------- ### Control FirewallWidgetProvider Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Manage the home screen widget for firewall control. Tapping the widget triggers an optimistic UI update and sends a broadcast to control the firewall. Manual widget refresh can be triggered via a broadcast. ```kotlin // The widget registers for: // android.appwidget.action.APPWIDGET_UPDATE // com.arslan.shizuwall.ACTION_FIREWALL_STATE_CHANGED // Tapping the widget triggers ACTION_WIDGET_CLICK, which: // 1. Checks backend readiness via FirewallUtils.checkBackendReady() // 2. Optimistically flips the widget icon // 3. Sends Intent to FirewallControlReceiver: val toggleIntent = Intent(context, FirewallControlReceiver::class.java).apply { action = MainActivity.ACTION_FIREWALL_CONTROL // internal action putExtra(MainActivity.EXTRA_FIREWALL_ENABLED, newState) // true = enable if (newState) putExtra(MainActivity.EXTRA_PACKAGES_CSV, selectedApps.joinToString( டிரான்ஸ்லேட்")) } context.sendBroadcast(toggleIntent) // Force a manual widget refresh from anywhere: val updateIntent = Intent(context, FirewallWidgetProvider::class.java) updateIntent.action = MainActivity.ACTION_FIREWALL_STATE_CHANGED context.sendBroadcast(updateIntent) ``` -------------------------------- ### ForegroundDetectionService - Broadcasts and Internal Logic Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Details the broadcast actions and extras for foreground app changes, and outlines the internal logic for Smart Foreground mode, including network rule application and retry mechanisms. ```kotlin // The service broadcasts foreground app changes internally: // Action: ForegroundDetectionService.ACTION_FOREGROUND_APP_CHANGED // Extras: EXTRA_PACKAGE_NAME (new foreground package) // EXTRA_PREVIOUS_PACKAGE (previously tracked package) ``` ```kotlin // Internal logic for Smart Foreground mode on each app switch: // 1. Allow new foreground app: set-package-networking-enabled true // 2. Block previous app: set-package-networking-enabled false // chain3 is re-validated before each rule batch (ensureChain3Enabled) // Failed commands are retried once after 300 ms (execWithRetry) ``` -------------------------------- ### Compile Daemon Script Source: https://github.com/ahmetcanarslan/shizuwall/blob/main/README.md Execute this script to compile the on-device daemon binary. Ensure prerequisites like Android SDK, Java 11, and d8 are met, and update script variables for your environment. ```bash chmod +x scripts/compile_daemon.sh ./scripts/compile_daemon.sh ``` -------------------------------- ### Enable Firewall via ADB Broadcast (Saved Apps) Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt This ADB command enables the ShizuWall firewall using the list of applications previously saved within the ShizuWall app. Ensure one of the supported backends (Shizuku, LADB, Root) is active. ```bash adb shell am broadcast \ -a shizuwall.CONTROL \ -n com.arslan.shizuwall/.receivers.FirewallControlReceiver \ --ez state true ``` -------------------------------- ### Query Chain 3 Firewall Framework Status Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt This command checks whether the Chain 3 firewall framework is currently enabled on the device. The output will be 'true' or 'false'. ```bash cmd connectivity get-chain3-enabled ``` -------------------------------- ### DaemonShellExecutor Usage Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Illustrates using the DaemonShellExecutor for commands via the LADB daemon. Includes notes on its retry mechanism and response parsing. ```kotlin // LADB daemon backend — socket on localhost:18522 with token auth + exponential back-off retry val daemonExecutor = DaemonShellExecutor(context) // Retries up to 3 times with 100 ms → 200 ms → 400 ms delays on connection failure val r2 = daemonExecutor.exec("cmd connectivity set-chain3-enabled true") // Daemon response patterns parsed internally: // "Error (code 1): " → ShellResult(exitCode=1, stderr=msg) // "Command finished with exit code 0" → ShellResult(exitCode=0, stdout=...) // "Error: Unauthorized" → ShellResult(exitCode=126, ...) – token mismatch, no retry ``` -------------------------------- ### Control App Network Access with ADB Source: https://github.com/ahmetcanarslan/shizuwall/blob/main/README.md Use these ADB commands to block or unblock network access for specific applications. Replace `` with the actual package name of the app you wish to control. ```bash cmd connectivity set-package-networking-enabled false ``` ```bash cmd connectivity set-package-networking-enabled true ``` -------------------------------- ### ForegroundDetectionService - Check and Enable Service Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Checks if the accessibility service is enabled and provides methods to auto-enable or disable it via shell commands. Requires an active Shizuku or LADB backend for shell operations. ```kotlin val enabled: Boolean = ForegroundDetectionService.isServiceEnabled(context) ``` ```kotlin val success: Boolean = ForegroundDetectionService.enableServiceViaShell(context) ``` ```kotlin val disabled: Boolean = ForegroundDetectionService.disableServiceViaShell(context) ``` -------------------------------- ### Manage Android Firewall Framework with ADB Source: https://github.com/ahmetcanarslan/shizuwall/blob/main/README.md These ADB commands are used to enable and disable the firewall framework on Android. Ensure you have the necessary permissions and that the connectivity chain is supported. ```bash cmd connectivity set-chain3-enabled true ``` ```bash cmd connectivity set-chain3-enabled false ``` -------------------------------- ### BootReceiver - Notification Details Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Specifies the notification channel, ID, title, and text used when the firewall needs manual re-enabling after a reboot. ```kotlin // Notification posted to channel "shizuwall_boot_channel" (NOTIFICATION_ID = 1001) // Title: R.string.firewall_reboot_title // Text: R.string.firewall_reboot_message (or firewall_reboot_apply_failed_message) ``` -------------------------------- ### Control ScreenLockMonitorService Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Sync the screen lock monitor service based on firewall mode and enabled state. The service applies and removes firewall rules automatically based on screen lock events and can be configured with a delay. ```kotlin // Sync (start or stop) the service based on current firewall mode and enabled state ScreenLockMonitorService.sync(context) // Internally: starts service if (enabled && mode in [SCREEN_LOCK_MODE, HYBRID]) // stops service otherwise // Service also reconciles state on start — e.g. if the device is already locked // but no blocks are active (state mismatch), it immediately fires the lock action. // Configurable lock delay (stored in SharedPreferences): prefs.edit().putInt(MainActivity.KEY_SCREEN_LOCK_DELAY_SECONDS, 5).apply() // 2–10 s range // Default: MainActivity.DEFAULT_SCREEN_LOCK_DELAY_SECONDS // When screen turns off: // startLockDelay() → after delay → if still locked → block selected apps via chain3 // When screen unlocks (USER_PRESENT or polled after SCREEN_ON): // unblock selected apps → set-chain3-enabled false ``` -------------------------------- ### Disable Firewall with ADB Broadcast Source: https://github.com/ahmetcanarslan/shizuwall/blob/main/README.md Use this command to disable the firewall for saved selected apps. Ensure Shizuku, ADB, or Root is active. ```bash adb shell am broadcast -a shizuwall.CONTROL -n com.arslan.shizuwall/.receivers.FirewallControlReceiver --ez state false ``` -------------------------------- ### Android Chain 3 Commands Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Direct shell commands to manage the Android Chain 3 firewall framework. These commands allow enabling/disabling the framework and controlling network access for specific applications. ```APIDOC ## Android Chain 3 Commands ### Description Direct shell commands that ShizuWall issues through whichever backend is active. These are the low-level primitives that all higher-level components wrap. ### Enable Firewall Framework ```bash cmd connectivity set-chain3-enabled true ``` ### Block App Network Access ```bash cmd connectivity set-package-networking-enabled false com.example.targetapp ``` ### Unblock App Network Access ```bash cmd connectivity set-package-networking-enabled true com.example.targetapp ``` ### Query Firewall Framework Status ```bash cmd connectivity get-chain3-enabled ``` ### Disable Firewall Framework ```bash cmd connectivity set-chain3-enabled false ``` ``` -------------------------------- ### FirewallMode Enum and Predicates Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Defines the seven operational modes for the firewall and provides helper functions to check mode properties. Persisted as a string in SharedPreferences. ```kotlin // All available modes enum class FirewallMode { DEFAULT, // Block selected apps immediately; unblock on toggle-off ADAPTIVE, // Apps can be added/removed from the blocked set while firewall is ON SCREEN_LOCK_MODE, // Block selected apps when screen locks; unblock on unlock SMART_FOREGROUND, // Only the current foreground app is allowed; all others blocked WHITELIST, // Block ALL internet-capable apps EXCEPT the selected (whitelisted) ones FOCUS_TRACKER, // Block selected apps only while ShizuWall itself is NOT in foreground HYBRID; // Per-app mode assignment (DEFAULT / SCREEN_LOCK / SMART_FOREGROUND) } // Retrieve mode from saved prefs val modeName = prefs.getString(MainActivity.KEY_FIREWALL_MODE, FirewallMode.DEFAULT.name) val mode = FirewallMode.fromName(modeName) // returns DEFAULT on invalid/null input // Predicates mode.allowsDynamicSelection() // true for ADAPTIVE, SCREEN_LOCK_MODE, SMART_FOREGROUND, WHITELIST, HYBRID, FOCUS_TRACKER mode.isAdaptive() // true only for ADAPTIVE mode.isSmartForeground() // true only for SMART_FOREGROUND // Example: decide whether to start chain3 or require app selection first if (mode.allowsDynamicSelection()) { // OK to enable chain3 even with empty package list executor.exec("cmd connectivity set-chain3-enabled true") } else if (selectedApps.isEmpty()) { Toast.makeText(context, "Select apps first", Toast.LENGTH_SHORT).show() } ``` -------------------------------- ### ADB Broadcast Automation API - FirewallControlReceiver Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt An exported BroadcastReceiver that allows external scripts and task-automation apps to control the ShizuWall firewall over ADB. It supports enabling/disabling the firewall globally or for specific applications. ```APIDOC ## ADB Broadcast Automation API — FirewallControlReceiver ### Description Exported `BroadcastReceiver` that lets external scripts and task-automation apps control the firewall over ADB. It resolves the active package list from `SharedPreferences` when no `apps` extra is supplied, checks that the configured backend is ready, executes chain-3 commands asynchronously via `goAsync()`, persists state, and broadcasts `ACTION_FIREWALL_STATE_CHANGED` to refresh all UI surfaces. ### Enable Firewall (Saved Apps) ```bash adb shell am broadcast \ -a shizuwall.CONTROL \ -n com.arslan.shizuwall/.receivers.FirewallControlReceiver \ --ez state true ``` ### Disable Firewall (Saved Apps) ```bash adb shell am broadcast \ -a shizuwall.CONTROL \ -n com.arslan.shizuwall/.receivers.FirewallControlReceiver \ --ez state false ``` ### Enable Firewall (Specific Apps) ```bash adb shell am broadcast \ -a shizuwall.CONTROL \ -n com.arslan.shizuwall/.receivers.FirewallControlReceiver \ --ez state true \ --es apps "com.example.app1,com.example.app2" ``` ### Disable Firewall (Specific Apps) ```bash adb shell am broadcast \ -a shizuwall.CONTROL \ -n com.arslan.shizuwall/.receivers.FirewallControlReceiver \ --ez state false \ --es apps "com.example.app1,com.example.app2" ``` ### Note One of the three backends (Shizuku, LADB daemon, or Root) must be active. If none is available, the receiver logs a warning and shows a toast. ``` -------------------------------- ### SharedPreferences Keys in MainActivity Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Defines constants for SharedPreferences keys used to store various application settings. These include firewall status, selected apps, working modes, and more. ```kotlin const val PREF_NAME = "shizuwall_prefs" const val KEY_FIREWALL_ENABLED = "firewall_enabled" // Boolean const val KEY_FIREWALL_SAVED_ELAPSED = "firewall_saved_elapsed" // Long (elapsedRealtime) const val KEY_ACTIVE_PACKAGES = "active_packages" // Set const val KEY_SELECTED_APPS = "selected_apps" // Set const val KEY_SELECTED_COUNT = "selected_count" // Int const val KEY_WORKING_MODE = "working_mode" // String ("SHIZUKU"|"LADB"|"ROOT") const val KEY_FIREWALL_MODE = "firewall_mode" // String (FirewallMode name) const val KEY_SHOW_SYSTEM_APPS = "show_system_apps" // Boolean const val KEY_APP_MONITOR_ENABLED = "app_monitor_enabled" // Boolean const val KEY_SMART_FOREGROUND_APP = "smart_foreground_app" // String (package name) const val KEY_LAST_FOREGROUND_APP = "last_foreground_app" // String (package name) const val KEY_APP_MODES = "app_modes" // String (JSON object) const val KEY_SCREEN_LOCK_DELAY_SECONDS = "screen_lock_delay_sec" // Int (2–10) const val KEY_APPLY_ROOT_RULES_AFTER_REBOOT = "apply_root_after_reboot" // Boolean const val KEY_FIREWALL_UPDATE_TS = "firewall_update_ts" // Long (System.currentTimeMillis) ``` -------------------------------- ### Disable Firewall for Specific Apps via ADB Broadcast Source: https://github.com/ahmetcanarslan/shizuwall/blob/main/README.md Disable the firewall for a specific list of apps using a CSV package string. Ensure Shizuku, ADB, or Root is active. ```bash adb shell am broadcast -a shizuwall.CONTROL -n com.arslan.shizuwall/.receivers.FirewallControlReceiver --ez state false --es apps "com.example.app1,com.example.app2" ``` -------------------------------- ### Disable Android Chain 3 Firewall Framework Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt This command disables the entire Chain 3 firewall framework and clears all previously set per-package network rules. Run this to reset all blocking configurations. ```bash cmd connectivity set-chain3-enabled false ``` -------------------------------- ### Disable Firewall via ADB Broadcast (Specific Apps) Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt This ADB command disables the ShizuWall firewall for a specific list of applications provided as a CSV string. Ensure one of the supported backends (Shizuku, LADB, Root) is active. ```bash adb shell am broadcast \ -a shizuwall.CONTROL \ -n com.arslan.shizuwall/.receivers.FirewallControlReceiver \ --ez state false \ --es apps "com.example.app1,com.example.app2" ``` -------------------------------- ### Disable Firewall via ADB Broadcast (Saved Apps) Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt This ADB command disables the ShizuWall firewall using the list of applications previously saved within the ShizuWall app. Ensure one of the supported backends (Shizuku, LADB, Root) is active. ```bash adb shell am broadcast \ -a shizuwall.CONTROL \ -n com.arslan.shizuwall/.receivers.FirewallControlReceiver \ --ez state false ``` -------------------------------- ### ShellExecutor Interface and Result Data Class Source: https://context7.com/ahmetcanarslan/shizuwall/llms.txt Defines the ShellExecutor interface for executing commands and the ShellResult data class for wrapping command output and exit codes. ShellResult includes helper properties for success checks. ```kotlin interface ShellExecutor { suspend fun exec(command: String): ShellResult } data class ShellResult(val exitCode: Int, val stdout: String, val stderr: String) { val success: Boolean get() = exitCode == 0 // True when the command "failed" only because the UID was already absent from the map — // i.e. the block was already not present, which counts as effective success. val isEffectivelySuccess: Boolean get() = success || isUidOwnerMapMissing } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.