Skip to content
bea04mmPublic

About

Offline Kotlin & Jetpack Compose Android app to scroll apps hands-free using volume buttons or Bluetooth remotes, with presets, custom key learning, and a Quick Settings tile.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

KeyScroll

A lightweight, offline Android app built with Kotlin and Jetpack Compose that turns your phone's volume buttons or paired Bluetooth remotes into hands-free scroll gestures.

Features

  • Two Scroll Presets:
    • Reels & TikTok: Fast vertical swipe (50% distance, 220 ms) for short-form video feeds.
    • Reading & Feeds: Gentler scroll (34% distance, 420 ms) for books, articles, and browsers.
  • Fine-Tuning Options: Adjust scroll distance (15%–74%), swipe duration (120–850 ms), swap up/down direction, or enable hold-to-repeat.
  • Volume Buttons & Bluetooth Remotes:
    • Works with your phone's volume keys (can be turned off when you only want an external Bluetooth remote to scroll).
    • Supports standard Bluetooth remote/media keys (Volume Up/Down, Page Up/Down, Media Next/Previous, and external D-Pad).
    • Custom Button Mapper: Tap Set for Scroll Down or Scroll Up and press any button on your paired Bluetooth clicker or shutter to bind it directly.
  • 1-Tap Quick Settings Toggle & Background Stability:
    • Includes a Quick Settings tile (KeyScroll) to pause or resume scrolling from anywhere (long-press the tile to open KeyScroll settings; Add Tile hides automatically once pinned).
    • Isolates MainActivity in :ui with excludeFromRecents="true", syncs via KeyScrollStateProvider, and runs a silent keep-alive foreground service (KeepAliveForegroundService) while Accessibility is connected so clearing Recent Apps does not stop the service or Quick Settings tile.
    • Automatically passes volume presses through normally when paused, on the lock screen, or while the screen is off.

Privacy & Permissions

KeyScroll is designed to be auditable and safe to run as an Accessibility service:

  • No network or screen-reading permissions: Declares only FOREGROUND_SERVICE and FOREGROUND_SERVICE_SPECIAL_USE so the silent keep-alive service protects Accessibility against OEM memory cleaners. Declares no INTERNET or notification permissions.
  • No screen reading: accessibility_service_config.xml sets android:canRetrieveWindowContent="false", so Android only delivers hardware/Bluetooth key events and permits swipe gestures (dispatchGesture).
  • Local storage only: Preferences are saved privately on-device via SharedPreferences.

Requirements

  • Android 8.0+ (minSdk = 26, targetSdk = 36)
  • JDK 21 and Android SDK (API 36) to build from source

Building & Installing (USB Debugging)

Enable Developer options → USB debugging on your phone and connect it via USB:

  • Android Studio: Select your phone in the device dropdown and click Run to build and install directly over USB debugging.
  • Command line (Gradle / ADB):
# Run unit tests
./gradlew testDebugUnitTest

# Build and install directly onto your connected phone over USB debugging
./gradlew installDebug
./gradlew installRelease

# Or build debug & release APKs without installing
./gradlew assembleDebug assembleRelease

On Windows PowerShell:

.\gradlew.bat testDebugUnitTest assembleDebug assembleRelease
# Or install directly over USB debugging:
.\gradlew.bat installRelease

Release builds are signed with the debug key in app/build.gradle.kts so installRelease (and adb install -r app/build/outputs/apk/release/app-release.apk) works directly over USB debugging without extra keystore setup.

Setup on Your Phone

  1. Enable Accessibility: Open KeyScroll and tap Open Accessibility → Downloaded apps → KeyScroll Button Scroller → turn it ON.
    • Manual APK sideload fallback: Installing over USB debugging / Android Studio avoids Android 13+'s Restricted setting block; if you ever install an APK directly on-device and Android blocks the toggle, open App Info → ⋮ menu → Allow restricted settings first.
  2. Allow Unrestricted Battery: If KeyScroll prompts that battery is restricted, tap Fix (or open App Info → Battery) and choose Unrestricted / No restrictions so Android does not stop the service in the background.
  3. Xiaomi / Redmi / POCO (MIUI & HyperOS): During setup, tap Autostart (or enable Background autostart in system app permissions) so Recent Apps cleanup keeps Accessibility alive. The setup prompt disappears automatically once Accessibility is enabled.
  4. Pin the Quick Settings Tile: Tap Add Tile (Android 13+, hidden automatically once added) or drag KeyScroll into your Quick Settings shade for one-tap ON/OFF control. Long-press the tile anytime to open KeyScroll settings.

Project Structure

app/src/main/
├── AndroidManifest.xml
├── java/dev/local/keyscroll/
│   ├── MainActivity.kt                        # UI entry point (:ui), settings shortcuts & key learning
│   ├── data/
│   │   ├── KeyScrollStateProvider.kt          # Cross-process IPC bridge keeping UI isolated
│   │   └── ScrollerPreferences.kt             # SharedPreferences + StateFlow repository
│   ├── domain/
│   │   ├── GestureCalculator.kt               # Safe viewport swipe coordinate math
│   │   ├── KeyActionResolver.kt               # Key mapping, inversion, and lock/screen guards
│   │   └── KeyEventMapper.kt                  # Maps Android KeyEvent to domain snapshot
│   ├── model/ScrollModels.kt                  # Presets, config, decisions, and key codes
│   ├── service/
│   │   ├── KeepAliveForegroundService.kt      # Silent FGS keeping Accessibility alive across cleaners
│   │   ├── KeyScrollAccessibilityService.kt   # Intercepts keys and dispatches swipe gestures
│   │   └── ScrollTileService.kt               # Quick Settings 1-tap toggle tile
│   └── ui/
│       ├── MainScreen.kt                      # Jetpack Compose UI and @Preview definitions
│       ├── MainViewModel.kt                   # Screen state and system service status sync
│       └── theme/Theme.kt                     # Lavender & violet Material 3 color schemes
└── res/
    ├── drawable/                              # Adaptive launcher icons & Quick Settings tile icon
    ├── mipmap-anydpi-v26/                     # Adaptive & monochrome launcher icon definitions
    ├── values/                                # App strings and base theme
    └── xml/accessibility_service_config.xml   # Minimal Accessibility capabilities config

License

This project is licensed under the MIT License.

About

Offline Kotlin & Jetpack Compose Android app to scroll apps hands-free using volume buttons or Bluetooth remotes, with presets, custom key learning, and a Quick Settings tile.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages