Repository navigation
feat: add Android Auto connected/disconnected automation triggers - #1363
Merged
Merged
Conversation
jawzf
force-pushed
the
feature/android-auto-modes
branch
from
October 13, 2026 15:46
c727d57 to
2044b47
Compare
This was referenced Oct 13, 2026
Owner
|
@jawzf some older PRs caused conflcits, can you resolve? |
sameerasw
marked this pull request as draft
October 15, 2026 11:53
jawzf
force-pushed
the
feature/android-auto-modes
branch
from
October 15, 2026 15:43
2044b47 to
b3acd1f
Compare
Contributor
Author
|
Rebased on the latest develop and resolved the conflicts with the location triggers. Generated by Claude Code |
jawzf
marked this pull request as ready for review
October 15, 2026 15:46
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qsx9zsmJCSpqGMWqYtXdsS
sameerasw
force-pushed
the
feature/android-auto-modes
branch
from
October 15, 2026 16:48
b3acd1f to
5b805bf
Compare
sameerasw
approved these changes
Oct 15, 2026
sameerasw
left a comment
Owner
There was a problem hiding this comment.
Thanks for your contributions <3
sameerasw
added a commit
that referenced
this pull request
Oct 15, 2026
…1365) <!-- claude-projects-attribution: {"github_login":"jawzf"} --> _Requested by **Joe** · [project thread](https://claude.ai/code/project/chan_01FyKGsodrf7JS5wLrjvnZmV?thread=cmsg_01FyKGsodrf7JS5wLrjvnZmV5gqq2zaavhZ6yd58kd52ru)_ ## Description Adds a **Set Mode** action under Sound & Media (Android 15+, needs Shizuku). It picks any Mode from Settings > Modes and turns it on or off. - Runs through Shizuku as shell. Shell holds `MANAGE_NOTIFICATIONS`, so it can switch Modes that Essentials doesn't own: the built-in ones, Modes the user created, and rules owned by other apps. - On Android 17, when `refactor_modes_code` is on, Modes live in the new `contextual_mode` service (`IContextualModeManager`), and the old `INotificationManager.getAutomaticZenRules` throws `IllegalStateException: can't be used when refactor_modes_code is on`. The action uses `contextual_mode` first and falls back to `INotificationManager`. It reads both the older `Map` result and the newer `ParceledListSlice<AutomaticZenRule.AzrWithId>` result. - If the saved Mode's id no longer exists, it falls back to the Mode's name, so the action keeps working when a Mode is deleted and recreated. - When it can't run, it shows a toast: Shizuku isn't running, permission is missing, the Mode no longer exists, or the system call fails. - It can be set up from every action picker: DIY automations, Status Glance, Duo and the island gesture picker. Example: combined with the Android Auto triggers in #1363, Android Auto Connected → Set Mode: Driving on gives a Samsung-style Driving mode. **Testing:** tested on an Android 17 emulator with Shizuku. The picker listed Bedtime, Driving, Transit and a custom "Test Drive" Mode. Turning Test Drive on set `zen_mode` to 1, and Settings showed it on. Turning it off set `zen_mode` back to 0, and Settings showed it off. When a Mode was deleted after it had been chosen, the action showed "Mode \"Temp Mode\" no longer exists". I haven't checked setting it up from the Status Glance, Duo and gesture pickers, because those screens need the accessibility service. Not yet tested on a physical Pixel. ## Type of change - [ ] Bug fix - [x] New feature - [ ] UI / visual update - [ ] Performance improvement - [ ] Refactoring / cleanup - [ ] Translations - [ ] Build / CI tooling ## UI changes <!-- 2_set_mode_picker.png --> <img width="1344" height="2992" alt="2_set_mode_picker" src="https://github.com/user-attachments/assets/99cace6f-e9c8-4c0f-b5d7-94fd7eabdce7" /> Set Mode settings: choose a Mode and Turn on / Turn off <!-- 3_mode_turned_on.png --> <img width="1344" height="2992" alt="3_mode_turned_on" src="https://github.com/user-attachments/assets/05c61975-7209-4b7b-bc54-2628920d7b4b" /> Settings > Modes after the action turned Test Drive on <!-- 4_mode_turned_off.png --> <img width="1344" height="2992" alt="4_mode_turned_off" src="https://github.com/user-attachments/assets/aba6f175-e012-4ca1-8a66-b350fc3ee123" /> Settings > Modes after the action turned Test Drive off ## Checklist Before submitting, please make sure: - [x] The base branch is set to `develop` (not `main`). - [x] The app builds cleanly locally with `./gradlew assembleDebug`. - [x] Unit tests pass with `./gradlew testDebugUnitTest`. - [x] You tested the changes on a device or emulator (including Shizuku or Root if applicable). - [ ] New preferences use `SettingsRepository` for keys and getter/setter methods. - [ ] New user-facing settings are registered in `FeatureRegistry.kt` for search indexing. - [ ] New UI follows the design system in `ui/core/` (`RoundedCardContainer`, `IconToggleItem`, etc.). - [x] Strings are added to `res/values/strings.xml` and drawables use rounded variants (`R.drawable.rounded_*`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Qsx9zsmJCSpqGMWqYtXdsS
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.
Requested by Joe · project thread
Description
Adds Android Auto Connected and Android Auto Disconnected triggers to DIY automations, in the Connectivity & Network category with a car icon.
AndroidAutoModulereuses the existingCarConnectionMonitorand only fires when the projection state actually changes.CarConnectionre-emits its current value, so repeated emits are ignored.Paired with the Set Mode action (now in #1365), this gives Pixels a Samsung-style Driving mode: Android Auto Connected → turn the Driving Mode on, Android Auto Disconnected → turn it off.
Testing: tested on an Android 17 emulator. Both triggers appear in the trigger picker and can be saved. I haven't fired them in a real car, because the emulator has no Android Auto.
The Set Mode action that was part of this PR has moved to #1365.
Type of change
UI changes
Android Auto Connected / Disconnected in the trigger picker
Checklist
Before submitting, please make sure:
develop(notmain)../gradlew assembleDebug../gradlew testDebugUnitTest.SettingsRepositoryfor keys and getter/setter methods.FeatureRegistry.ktfor search indexing.ui/core/(RoundedCardContainer,IconToggleItem, etc.).res/values/strings.xmland drawables use rounded variants (R.drawable.rounded_*).🤖 Generated with Claude Code
https://claude.ai/code/session_01Qsx9zsmJCSpqGMWqYtXdsS