Repository navigation
Conversation
Author
|
Love that claude added his piece. Overall just created this as I finally got OneUi 9.0 with the bluetooth fix. |
LoMiLiMiT
force-pushed
the
android/listening-mode-shortcut
branch
from
October 19, 2026 22:24
76961c4 to
7edaa32
Compare
Adds a "Toggle listening mode" static app shortcut backed by a headless activity that switches between two user-selected listening modes. The two modes are picked in app settings (default: Noise Cancellation and Transparency). Because it is a regular app shortcut, it can be used from the launcher, Samsung Modes and Routines, and button/gesture mapping apps.
App shortcut launches carry FLAG_ACTIVITY_TASK_ON_HOME, so triggering the toggle shortcut from inside an app (e.g. via Modes and Routines) drops the user on the home screen when it finishes. No way of finishing the activity avoids this. Add a disabled-by-default launcher alias, enabled from a "Show in app list" setting. Button mapping settings such as Samsung's side key can launch it directly, which keeps the user in the app they were using.
…oggle" This reverts commit 1999bd0. The alias was meant to let button mapping tools launch the toggle directly, without the TASK_ON_HOME flag that app shortcut launches carry. In practice, Samsung Modes and Routines and Good Lock RegiStar both resolve "Open app" to the package's main launcher activity, so picking the alias opened LibrePods instead of toggling. The only working direct launch path (the side key long press set via adb settings) is not something users can configure, so the alias adds a setting that does nothing for them.
AirPods refuse the Off listening mode unless "Off Listening Mode" is enabled. With a pair like Noise Cancellation + Off, disabling that setting left the shortcut sending Off on every other press: the AirPods stayed in Noise Cancellation while the toast still said "Off". The shortcut now picks from Transparency, Adaptive and Noise Cancellation only. A stored pair that contains anything else falls back to the default pair. Also sort imports and update the activity comment.
LoMiLiMiT
force-pushed
the
android/listening-mode-shortcut
branch
from
October 19, 2026 22:27
7edaa32 to
a13fd13
Compare
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.
What
Adds a "Toggle listening mode" app shortcut that switches between two listening modes without opening the app.
ToggleListeningModeActivitysends the listening-mode command and shows a short toast with the new mode. If AirPods aren't connected, it shows "AirPods not connected" instead.res/xml/shortcuts.xml) is attached toMainActivity.Why
Switching modes means opening the app, the QS tile (which cycles through every mode), or a long press on the stem. Most people just flip between two modes. An app shortcut can be triggered from the launcher, Samsung Modes and Routines, Good Lock RegiStar, Tasker and similar tools.
Related: #155 (the same idea for Linux).
Known limitation
Android adds
FLAG_ACTIVITY_TASK_ON_HOMEto every app shortcut launch. When the toggle is triggered from inside another app (e.g. via a Modes and Routines button action), the user lands on the home screen after it finishes. I testedfinish(),moveTaskToBack(true),finishAndRemoveTask()and moving the app's own task to the front; none returns to the previous app, because an app can't see other apps' tasks. I also tried an opt-in launcher alias, but Modes and Routines and RegiStar resolve "Open app" to the main activity, so it didn't help and I removed it again.Notes
exported="true"so system components can launch it directly. The only thing it can do is switch between the two modes the user chose.shortcuts.xml, so this should port over easily.Testing
Galaxy S23 Ultra (SM-S918B), One UI 9 / Android 17, no root, AirPods Pro. Launches used the real shortcut flags (
0x1000c000) and the toggle's result was compared with the mode the AirPods reported back: