Conversation
## Summary Adds two new automation trigger types: **Bluetooth device connected/disconnected** and **Wi-Fi network connected/disconnected**. Users can now build automations that fire an action when the phone connects to (or disconnects from) a specific paired Bluetooth device or a specific Wi-Fi network — the same way existing triggers like Charger Connected or Schedule work today. ## What's new - **`Trigger.kt`**: 4 new sealed subtypes — `BluetoothConnected`/`BluetoothDisconnected` (device address + name) and `WifiConnected`/`WifiDisconnected` (SSID), all configurable via a settings sheet like `Trigger.Schedule`. - **`BluetoothModule`** (new): dynamic `BroadcastReceiver` on `ACTION_ACL_CONNECTED`/`ACTION_ACL_DISCONNECTED`, filtered by MAC address. - **`WifiModule`** (new): `ConnectivityManager.NetworkCallback` on the Wi-Fi transport, resolving the active SSID via `WifiManager` and firing on connect/lost. - **`AutomationManager`**: wires both modules into the existing module lifecycle (same pattern as Power/Display/Time modules). - **Editor UI**: two new trigger entries in `AutomationEditorActivity`, each configurable through a bottom sheet: - `BluetoothDeviceSelectionSheet` — pick from the phone's paired devices (requests `BLUETOOTH_CONNECT` on Android 12+). - `WifiNetworkSelectionSheet` — if the app has **Shizuku** (or root) authorized, it runs `cmd wifi list-networks` under shell privileges and lets the user pick straight from the device's saved networks; otherwise it falls back to manual SSID entry with a "Use Current Network" helper (requests `ACCESS_FINE_LOCATION`, needed by Android to read the current SSID). - **Manifest**: added `ACCESS_WIFI_STATE` (the Bluetooth/location permissions needed were already present). ## Why Requested enhancement to make automations react to connectivity context (e.g. "turn on Wi-Fi calling when connected to home network", "mute when a specific headset disconnects") without needing a schedule or manual toggle. ## Test plan - [ ] Create a Trigger automation on "Bluetooth Device Connected"/"Disconnected" for a paired device and verify the linked action fires on connect/disconnect. - [ ] Create a Trigger automation on "Wi-Fi Network Connected"/"Disconnected". - [ ] Verify triggers still fire correctly after the app/service is killed and restarted (foreground service reattachment).
…iver registration context in BluetoothModule
…selection sheets to use RoundedCardContainer
…e and refined code
…ch result for QS Tile
…ompile time errors
- Lockdown feature requires shizuku, if no shizuku permission, It'll normally lock your phone, no lockdowns. - Lockdown feature removes weak unlock methods like face, fingerprint and require secure methods like pin, password or pattern. - **it works but you may face some bugs like It'll ask 2-3 times to unlock, bcs of adb glicthes... but it works.** If you don't want lockdown, you can continue with accessibility permission, by just adding the qs tile. Close #631
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.
This pull request introduces a new "Lockdown" Quick Settings tile, centralizes device lock logic, and refactors related features for improved maintainability and extensibility. It also adds a new "Lockdown mode" feature to the registry, updates supporting UI and search, and cleans up legacy code paths in favor of a unified utility.
New Quick Settings Tile and Feature:
Added a new
LockdownTileServicefor a "Lockdown" Quick Settings tile, including manifest registration and UI integration. The tile adapts its icon and label based on the current mode, and supports both click and long-press actions. [1] [2] [3] [4] [5]Registered "Lockdown mode" as a new feature in
FeatureRegistry, with associated search keywords, descriptions, and toggle logic. [1] [2]Centralized Device Lock Logic:
DeviceLockUtilsutility throughout the codebase, replacing scattered device lock implementations in services, widgets, and automation executors. This ensures all device locking (Accessibility, Input, Device Admin) is handled consistently. [1] [2] [3] [4] [5] [6] [7] [8] [9]Supporting Changes:
DEVICE_ADMINvalue to theScreenOffMethodenum for improved lock method selection.KEY_LOCKDOWN_MODEfor storing the lockdown mode state inSettingsRepository.Code Cleanup:
MainActivity. [1] [2] [3]These changes collectively add a robust, extensible "Lockdown" tile and feature, while improving code maintainability and user experience.