Skip to content

v0.4.4

Choose a tag to compare

@github-actions github-actions released this 13 Nov 16:32
· 13 commits to main since this release
3a632f6

AltShift v0.4.4 — feature and hardening release for Android 8.0+ since v0.4.2. It adds unlock-resilient recovery via USER_PRESENT, a temporary specialUse foreground-service watchdog that survives the Android 12+ Cached Apps Freezer, a theme-aware responsive Dynamic Island, split inactive-keyboard alerts, shortcut conflict prevention, and off-main-thread onboarding and app-picker loading with lazy icon decoding and no QUERY_ALL_PACKAGES. Transliteration, hotkey dispatch, and the zero-daemon typing path are unchanged.


🧊 Standby Watchdog & Unlock Recovery

  • KeyboardWatchdogService (specialUse): Keeps the process unfrozen while onboarding is complete, AltShift is enabled but another IME is selected, and at least one switch/overlay/alert path is usable. Stops immediately via stopSelf() once AltShift becomes the active IME, onboarding is reset, or no reconnect/alert path remains.
  • State-aware silent status: Posts on altshift_keyboard_watchdog (IMPORTANCE_MIN, ongoing, FOREGROUND_SERVICE_IMMEDIATE on API 31+), showing "Waiting for physical keyboard" when detached and "Monitoring keyboard connection" while attached with another IME active. Updates via notify() only on state changes; uses zero polling, timers, or wake locks, with guarded startForegroundService() / startForeground() calls.
  • Disconnect & reconnect cleanup: Detach cancels any stale "AltShift is inactive" alert and reconciles with present = false; attach either stops the watchdog (if AltShift switched back) or reconciles with present = true and shows the Dynamic Island again.
  • USER_PRESENT wake-up: Handled in the manifest and via a process-local receiver registered in AltShiftApplication.onCreate() (RECEIVER_EXPORTED on Android 13+) so screen unlock wakes frozen processes and restores AltShift (or surfaces the Dynamic Island) whenever a physical keyboard is attached.

📱 Responsive Dynamic Island & Split Alerts

  • Theme-aware capsule: KeyboardPromptOverlay applies the persisted ThemeMode (LIGHT/DARK/FOLLOW_SYSTEM) before inflating, uses dedicated prompt_surface (#F4F3FA / #252630) and prompt_stroke (#1F1B1B21 / #24FFFFFF) tokens, applies explicit setImageTintList() for icons, and renders a 4dp shadow inside clip-free 24dp/14dp/28dp padding at y = max(0, bottomInset() - 20dp).
  • Phone & tablet sizing: Phones use the inset width (0dp minWidth) and ellipsize the message before clipping actions; sw600dp+ uses an exact 420dp capsule with Switch back and [X] pinned to the right 12dp edge. Repeated prompts refresh callbacks and reset the 12-second timer, with cleanup on inflation/window failures.
  • Split inactive alerts (shared id 1001): Dismissing ([X]) or timing out posts a dismissible IMPORTANCE_DEFAULT reminder on altshift_keyboard_alerts_v2; cancelling the system IME picker from SwitchBackActivity without selecting AltShift posts an IMPORTANCE_HIGH heads-up on altshift_keyboard_alerts_urgent (without setOnlyAlertOnce(true)). Cancelled automatically when AltShift activates or the keyboard detaches.

🔐 Permissions, Performance & Integrity

  • QUERY_ALL_PACKAGES removed: Replaced with a narrow launcher <queries> block. Still declares no INTERNET permission; adds FOREGROUND_SERVICE and FOREGROUND_SERVICE_SPECIAL_USE.
  • Off-main-thread UI & lazy icons: Onboarding IME checks and app-picker label queries run on background executors. AppPickerDialog and HotkeyAdapter migrate to ListAdapter + DiffUtil and decode icons lazily per bound row with bounded LruCaches (48 / 32 entries, 2 daemon threads) and clean teardown.
  • Shortcut conflict prevention: Pure-JVM HotkeyBindingStore and HotkeyBinding.conflictsWith() prevent app hotkeys and the language switch from sharing a combination (with modifier-order equivalence).
  • Lifecycle & guidance: BootReceiver filters strictly for BOOT_COMPLETED / USER_PRESENT; HardwareInputService reconciles the watchdog on IME release and logs null InputConnection returns; onboarding and README note the OEM Auto-start toggle for Lenovo ZUI, Xiaomi HyperOS, and ColorOS.

🧪 Build, Tests & Verification

  • Version & cleanup: versionCode 11, versionName '0.4.4' (AltShift-v0.4.4.apk / AltShift-v0.4.4-debug.apk). Toolchain unchanged (minSdk 26, targetSdk 34, Java 21, Gradle 8.9, AGP 8.7.3). Removed obsolete bg_prompt_pill.xml; updated README.md (with measured memory/CPU breakdown) and STYLEGUIDE.md (watchdog, USER_PRESENT, ≤ 64 MB PSS budget, overlay, and alert contracts).
  • Automated checks: ./gradlew clean test lintDebug assembleDebug and post-merge ./gradlew test lintDebug assembleDebug passed with 0 Lint issues and expanded HotkeyBindingStoreTest and ModelTest JVM suites.
  • Device verification (Lenovo TB710FU, Android 16, 2000×3200, 400 dpi, debug APK):
    • Typing (active IME): 2041 KB Java heap, 7382 KB native heap, 41773 KB Total PSS, 0 KB Graphics, 0.0% idle CPU.
    • Standby watchdog (detached): 3629 KB Java heap, 9171 KB native heap, 52601 KB Total PSS, 0 KB Graphics, 0.0% idle CPU.
    • App picker peak: 5153 KB Java heap, 50832 KB native heap, 360592 KB Total PSS.
    • Verified Light/Dark Dynamic Island override, 420dp tablet alignment, 8dp inset clearance, 12s timeout and [X] standard reminders, cancelled-picker heads-up alert, and physical pogo-pin detach/reattach transitions.
  • Remaining manual checks: Phone-width (< 600dp) ellipsis with updated outer padding and attach/detach on non-Lenovo OEMs.

📥 Installation

Asset Description
AltShift-v0.4.4.apk Release build, R8-minified, signed with the CI release keystore.
AltShift-v0.4.4-debug.apk Debug build, unminified, signed with the local debug key.
adb install -r AltShift-v0.4.4.apk
adb shell ime enable ru.b1sted.altshift/.service.HardwareInputService
adb shell ime set ru.b1sted.altshift/.service.HardwareInputService

Optional provisioning grants:

adb shell pm grant ru.b1sted.altshift android.permission.WRITE_SECURE_SETTINGS
adb shell pm grant ru.b1sted.altshift android.permission.POST_NOTIFICATIONS
adb shell appops set ru.b1sted.altshift SYSTEM_ALERT_WINDOW allow
adb shell cmd deviceidle whitelist +ru.b1sted.altshift

Note: Debug and release APKs use different signing keys (adb uninstall ru.b1sted.altshift is required when switching between them). Uninstalling clears altshift_prefs, WRITE_SECURE_SETTINGS, and the battery exemption.


🔨 Building from Source

Requires JDK 21, Android SDK Platform 34 (Build-Tools 34.0.0), and sdk.dir in local.properties:

./gradlew test lintDebug assembleDebug
# Or signed release (with KEYSTORE_FILE / KEYSTORE_PASSWORD / KEY_ALIAS / KEY_PASSWORD or scripts/build-release.sh):
./gradlew assembleRelease

⚠️ Notes & Limitations

  • Temporary watchdog: Runs only while AltShift is enabled and another IME is active, using specialUse instead of connectedDevice to avoid Bluetooth/USB/Wi-Fi permissions; stops immediately once AltShift becomes active.
  • Platform & OEM scope: Cached Apps Freezer handling targets Android 12+ while remaining compatible with Android 8.0+; OEM background and FGS restrictions are logged without crashing the IME.
  • No hot-path or backup changes: Key dispatch/transliteration are untouched, and allowBackup="false" resets preferences on uninstall or pm clear.

🛡️ Security & Analysis (AltShift-v0.4.4.apk)


Full Changelog: v0.4.2...v0.4.4