ShizuStore

Thor Volume Link (ThorVolumeLink)

pth2000

0.2.4 · GitHub

Download APK
Vendor-specific Android 6.0+ 1 week ago MIT
13 ShizuStore
5k GitHub
36 Stars
2 MB Size

More about this app

Synchronized volume control for the dual displays of the AYN Thor

Thor Volume Link

简体中文 · English

Android CI License: MIT Android

Thor Volume Link is an open-source volume controller for the dual-screen AYN Thor handheld. It routes the hardware volume keys to the primary screen, the secondary screen, or both screens at a linked relative level.

Features

  • Primary, secondary, linked, and follow-focus volume-key modes
  • Direct control and proportional synchronization of the secondary-screen volume, or linked adjustment that keeps a manually set volume balance
  • Optional automatic following for primary-volume changes made through Android or other apps
  • Optional hardware-key mode switching with configurable key behavior and a selectable rotation of modes
  • Live primary and secondary volume status

Volume modes

Mode Volume-key behavior
Primary Keeps Android's native volume-key behavior, adjusts only the primary media volume, and shows the system volume panel.
Secondary Lets the app handle the volume keys and adjust only the secondary-screen volume without changing the primary volume.
Linked Adjusts the primary media volume and maps the secondary screen to the same relative percentage. Optional automatic following also synchronizes changes made through Android or other apps. Choosing Keep volume balance as the linked adjustment in Settings makes both screens move together while preserving a difference set by hand instead of overwriting it.
Follow focus Controls the most recently interacted-with display: the upper display uses primary volume and the lower display uses secondary volume. The target remains fixed while a volume key is held.

All four modes support short presses and native-style press-and-hold adjustment. Adjustment step under Settings → Key & controls applies when the app handles the hardware volume keys: in Secondary and Linked modes, and when Follow focus targets the lower display. Primary mode and Follow focus on the upper display retain Android's native step size. When the hardware mode key is enabled, holding it cycles through the modes selected under Settings → Key & controls → Modes in rotation (at least two); otherwise, modes remain selectable from the app's main screen.

Using the app while locked: All modes work normally while the device is locked as long as the display remains on. After the display turns off, the volume keys can directly adjust only the primary volume; in Linked mode, the secondary volume follows those changes. Due to system limitations, holding a volume key may not adjust continuously, and Secondary or Follow focus cannot control the lower display in this state.

Editions

Edition Package Minimum Android Secondary-volume backend Recommended for
Lite io.github.thorvolume.control.lite Android 5.0 / API 21 Settings.System compatibility path Recommended for the stock AYN Thor firmware
Standard io.github.thorvolume.control Android 6.0 / API 23 Authorized backend Users who prefer a modern target SDK

Lite is the recommended edition for the stock AYN Thor firmware. It only needs Android's modify-system-settings approval and does not depend on a companion app or service. Lite intentionally targets SDK 22: AOSP keeps a compatibility path that lets apps targeting Android 5.1 or lower modify custom Settings.System entries, while apps targeting newer SDK levels are rejected. AYN's secondary_screen_volume_level is such a vendor-defined entry.

See the relevant AOSP SettingsProvider implementation and Android's WRITE_SETTINGS documentation.

Standard targets a modern Android SDK and uses additional authorization to provide the same secondary-volume controls. It is intended for users who value current Android security and compatibility behavior; it is not a more feature-complete edition. The editions can be installed together, but do not enable both accessibility key services at the same time.

Getting started

  1. Install Lite first.
  2. Open Thor Volume Link and allow modify-system-settings access.
  3. Enable the app's key service in Android Accessibility settings.
  4. Open Settings → Key & controls and decide whether a hardware key should switch modes.
  5. Select Primary, Secondary, Linked, or Follow focus on the main screen.

If you choose Standard, follow the authorization guidance on the main screen. Only the method selected by the user is active.

When hardware-key mode switching is disabled, the configured mode key keeps its original system behavior. Volume Up and Volume Down continue to follow the mode selected in the app.

Privacy and permissions

The accessibility service filters hardware keys and uses only the display ID attached to UI events to calibrate Follow Focus. It does not retrieve window content or read screen text, touch input, or data from other apps.

  • MODIFY_AUDIO_SETTINGS adjusts the primary media volume.
  • VIBRATE provides mode-change feedback.
  • INTERNET is used only when the user manually checks the latest GitHub Release.
  • WAKE_LOCK briefly keeps the CPU active only while completing linked-volume synchronization with the screen off.
  • Lite requests modify-system-settings access for its compatibility backend.
  • Standard requests permission from the single backend selected by the user: either Shizuku for its UserService or su for Root access.

How it works

AYN Thor firmware exposes the secondary-screen volume through:

Settings.System: secondary_screen_volume_level
Range: 0–15

Follow Focus observes the AYN firmware’s Settings.System: focus_change value, which increments as focus changes between displays. After a reboot, the app invalidates the old odd/even mapping and calibrates it once from a reliable display source. Standard can use the current system focus state; the app window and accessibility display events provide fallback anchors. Once calibrated, only focus_change is used until the next reboot. Until an anchor is available, the app safely falls back to the primary display. The target is locked for the duration of each volume-key press.

Lite accesses this setting through Android's target-SDK compatibility behavior. Standard reads and writes it through either an official Shizuku UserService or a Root shell powered by libsu. It never uses both backends at once. Shared mode, preference, accessibility-service, and UI code lives in app/src/main; backend-specific code lives in app/src/lite and app/src/standard.

Building

Requirements:

  • Android Studio or Android SDK command-line tools
  • Android SDK 35
  • JDK 17 for Gradle

Clone the repository and build both editions:

git clone https://github.com/pth2000/ThorVolumeLink.git
cd ThorVolumeLink
./gradlew assembleLiteDebug assembleStandardDebug

On Windows PowerShell:

.\gradlew.bat assembleLiteDebug assembleStandardDebug

Debug APKs are written to:

app/build/outputs/apk/lite/debug/
app/build/outputs/apk/standard/debug/

Run static checks with:

./gradlew lintLiteDebug lintStandardDebug

License

Thor Volume Link is available under the MIT License.

The Standard edition uses Shizuku API under the MIT License and libsu under the Apache License 2.0. See third-party notices.

Close

How Shizuku is used

Can sync and step second screen volume and detect the focused display via Shizuku with `settings` and `dumpsys input`.

This is an AI-assisted analysis of Shizuku-related usages in the app's public source code. It is best effort, so it may not catch every single usage.

How this app uses Shizuku

Shizuku runs a privileged helper that writes the second screen volume setting and checks which display is focused, while volume key handling and linked sync supply the values.

  • Set second screen volume: sets the second display to a level derived from the main volume or a sync action, applied with the settings put shell command through Shizuku.
  • Step second screen volume: raises or lowers the second display by the chosen step when volume keys are pressed, read then written with the settings get and settings put shell commands through Shizuku.
  • Detect focused display: checks the currently focused display to calibrate follow focus behavior, read with the dumpsys input shell command through Shizuku.

Android APIs or commands used

  • settings get
  • settings put
  • dumpsys input

Notable details

Reading the current second screen level does not need Shizuku and works through the normal system settings read. Values are limited to 0 to 15.

Close

Changelog

What's new for version 0.2.4

Changelog

Features

  • Added a Keep volume balance option for Linked mode, allowing both screens to move together without overwriting a manually configured volume difference (requested in #4 ).
  • Added configurable mode rotation for the hardware mode-switch key.

Fixes

  • Improved long-press volume handling by merging pending secondary-volume changes.
  • Improved Follow Focus calibration and accessibility-service detection.
  • Added a timeout for Shizuku backend startup.

Lite is recommended for the stock AYN Thor firmware.

Full Changelog: https://github.com/pth2000/ThorVolumeLink/compare/v0.2.3...v0.2.4

Close

Permissions

6 permissions requested

  • moe.shizuku.manager.permission.API_V23
  • android.permission.MODIFY_AUDIO_SETTINGS
  • android.permission.VIBRATE
  • android.permission.INTERNET
  • android.permission.WAKE_LOCK
  • io.github.thorvolume.control.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
Close