[PR #181] [CLOSED] Add Google Assistant shortcuts for noise control and conversational awareness #319

Closed
opened 2026-03-02 12:40:37 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kavishdevar/librepods/pull/181
Author: @Copilot
Created: 7/13/2025
Status: Closed

Base: mainHead: copilot/fix-8a79550c-f768-465d-8787-7b8589ff0005


📝 Commits (4)

  • 1a63377 Initial plan
  • 0492523 Initial exploration and plan for Google Assistant shortcuts
  • cffe06f Implement Google Assistant shortcuts for noise control and conversational awareness
  • f7aada9 Add documentation and improve shortcut handler robustness

📊 Changes

8 files changed (+361 additions, -8 deletions)

View changed files

📝 README.md (+24 -0)
📝 android/app/src/main/AndroidManifest.xml (+20 -0)
android/app/src/main/java/me/kavishdevar/librepods/ShortcutHandlerActivity.kt (+153 -0)
📝 android/app/src/main/res/values/strings.xml (+8 -0)
android/app/src/main/res/xml/shortcuts.xml (+96 -0)
📝 android/build.gradle.kts (+0 -1)
📝 android/gradle/libs.versions.toml (+6 -7)
docs/google-assistant-shortcuts.md (+54 -0)

📄 Description

Implements Google Assistant voice control for AirPods features as requested in the issue. Users can now control noise control modes and conversational awareness using natural voice commands.

Features Added

Voice Commands for Noise Control

  • "Hey Google, turn on noise cancellation" - Switches to noise cancellation mode
  • "Hey Google, turn on transparency mode" - Switches to transparency mode
  • "Hey Google, turn on adaptive transparency" - Switches to adaptive mode
  • "Hey Google, turn off noise control" - Switches to off mode

Voice Commands for Conversational Awareness

  • "Hey Google, turn on conversational awareness" - Enables conversational awareness
  • "Hey Google, turn off conversational awareness" - Disables conversational awareness

Technical Implementation

Uses Android's shortcuts framework instead of App Actions (as requested since the app isn't on Play Store). The implementation:

  1. Shortcuts Definition (res/xml/shortcuts.xml) - Defines all available Google Assistant shortcuts
  2. Handler Activity (ShortcutHandlerActivity.kt) - Processes shortcut intents and communicates with AirPodsService
  3. Manifest Updates - Registers shortcuts and handler activity
  4. Error Handling - Validates service availability, connection status, and provides user feedback

Files Added/Modified

  • res/xml/shortcuts.xml - Google Assistant shortcut definitions
  • ShortcutHandlerActivity.kt - Intent handler with robust error handling
  • AndroidManifest.xml - Shortcuts registration and activity declaration
  • res/values/strings.xml - String resources for shortcuts
  • docs/google-assistant-shortcuts.md - Comprehensive usage documentation
  • README.md - Added Google Assistant integration section

How It Works

  1. User says voice command to Google Assistant
  2. Google Assistant matches command to LibrePods shortcut
  3. Shortcut launches ShortcutHandlerActivity with appropriate intent
  4. Handler validates LibrePods service is running and AirPods are connected
  5. Handler sends control command to AirPodsService via existing AACPManager
  6. User receives confirmation toast with operation result

Requirements

  • LibrePods service must be running
  • AirPods must be connected to the device
  • Google Assistant enabled and configured

Error Handling

The implementation includes comprehensive error handling:

  • Service availability checks
  • Connection status validation
  • Invalid parameter detection
  • User-friendly error messages via toast notifications
  • Detailed logging for troubleshooting

Documentation

Added complete documentation including setup instructions, available commands, troubleshooting guide, and technical implementation details.

Fixes the issue by providing the exact functionality requested: voice control for noise control modes and conversational awareness through Google Assistant shortcuts that work with sideloaded apps.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/lib/gradle-daemon-main-8.11.1.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/lib/agents/gradle-instrumentation-agent-8.11.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.11.1 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kavishdevar/librepods/pull/181 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 7/13/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `copilot/fix-8a79550c-f768-465d-8787-7b8589ff0005` --- ### 📝 Commits (4) - [`1a63377`](https://github.com/kavishdevar/librepods/commit/1a633775a39afcc8a4c7070957f050eda4bd04bf) Initial plan - [`0492523`](https://github.com/kavishdevar/librepods/commit/049252374127ce6cbc608f1d0d9e7f8f5cce7413) Initial exploration and plan for Google Assistant shortcuts - [`cffe06f`](https://github.com/kavishdevar/librepods/commit/cffe06f09e5c53b1d049fa4fb01413a2a513c78e) Implement Google Assistant shortcuts for noise control and conversational awareness - [`f7aada9`](https://github.com/kavishdevar/librepods/commit/f7aada92cdaeb8aa53501e9991a7e7778ed2d652) Add documentation and improve shortcut handler robustness ### 📊 Changes **8 files changed** (+361 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+24 -0) 📝 `android/app/src/main/AndroidManifest.xml` (+20 -0) ➕ `android/app/src/main/java/me/kavishdevar/librepods/ShortcutHandlerActivity.kt` (+153 -0) 📝 `android/app/src/main/res/values/strings.xml` (+8 -0) ➕ `android/app/src/main/res/xml/shortcuts.xml` (+96 -0) 📝 `android/build.gradle.kts` (+0 -1) 📝 `android/gradle/libs.versions.toml` (+6 -7) ➕ `docs/google-assistant-shortcuts.md` (+54 -0) </details> ### 📄 Description Implements Google Assistant voice control for AirPods features as requested in the issue. Users can now control noise control modes and conversational awareness using natural voice commands. ## Features Added ### Voice Commands for Noise Control - **"Hey Google, turn on noise cancellation"** - Switches to noise cancellation mode - **"Hey Google, turn on transparency mode"** - Switches to transparency mode - **"Hey Google, turn on adaptive transparency"** - Switches to adaptive mode - **"Hey Google, turn off noise control"** - Switches to off mode ### Voice Commands for Conversational Awareness - **"Hey Google, turn on conversational awareness"** - Enables conversational awareness - **"Hey Google, turn off conversational awareness"** - Disables conversational awareness ## Technical Implementation Uses Android's shortcuts framework instead of App Actions (as requested since the app isn't on Play Store). The implementation: 1. **Shortcuts Definition** (`res/xml/shortcuts.xml`) - Defines all available Google Assistant shortcuts 2. **Handler Activity** (`ShortcutHandlerActivity.kt`) - Processes shortcut intents and communicates with `AirPodsService` 3. **Manifest Updates** - Registers shortcuts and handler activity 4. **Error Handling** - Validates service availability, connection status, and provides user feedback ## Files Added/Modified - ✅ `res/xml/shortcuts.xml` - Google Assistant shortcut definitions - ✅ `ShortcutHandlerActivity.kt` - Intent handler with robust error handling - ✅ `AndroidManifest.xml` - Shortcuts registration and activity declaration - ✅ `res/values/strings.xml` - String resources for shortcuts - ✅ `docs/google-assistant-shortcuts.md` - Comprehensive usage documentation - ✅ `README.md` - Added Google Assistant integration section ## How It Works 1. User says voice command to Google Assistant 2. Google Assistant matches command to LibrePods shortcut 3. Shortcut launches `ShortcutHandlerActivity` with appropriate intent 4. Handler validates LibrePods service is running and AirPods are connected 5. Handler sends control command to `AirPodsService` via existing `AACPManager` 6. User receives confirmation toast with operation result ## Requirements - LibrePods service must be running - AirPods must be connected to the device - Google Assistant enabled and configured ## Error Handling The implementation includes comprehensive error handling: - Service availability checks - Connection status validation - Invalid parameter detection - User-friendly error messages via toast notifications - Detailed logging for troubleshooting ## Documentation Added complete documentation including setup instructions, available commands, troubleshooting guide, and technical implementation details. Fixes the issue by providing the exact functionality requested: voice control for noise control modes and conversational awareness through Google Assistant shortcuts that work with sideloaded apps. > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `dl.google.com` > - Triggering command: `/usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/lib/gradle-daemon-main-8.11.1.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/lib/agents/gradle-instrumentation-agent-8.11.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.11.1` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to my [firewall allow list](https://gh.io/copilot/firewall-config) > > </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to start the survey. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 12:40:37 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librepods#319
No description provided.