Skip to content

Releases

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 13 Nov 20:26
61366f8

AltShift v0.5.0 — localization, per-app language selection, and responsive layout release for Android 8.0+ since v0.4.4. It adds a complete, idiomatic Russian translation, automatic matching to the system locale, and an in-app System default / English / Русский selector synced with Android 13+ App Language Settings. Every screen, dialog, overlay, and notification was re-proportioned for 360dp–sw800dp displays and landscape orientations with zero unwanted text truncation, and Android 16 device testing resolved the Material 3 IME fallback crash, background notification localization on API 33+, and BigTextStyle notification expansion. Transliteration, hotkey dispatch, and the zero-daemon typing path are unchanged.


🌐 Russian Localization & Per-App Language

  • Complete values-ru translation: Adds 140 Russian strings covering the dashboard, onboarding wizard, dialogs, Dynamic Island, notifications, safety warning, and watchdog status using native Android terminology (Поверх других окон, Без ограничений / С ограничениями, Для разработчиков, Отладка по USB, Автопереключение клавиатуры (по желанию), Как настроить, Назначение комбинации, Диагностика устройства, Идентификаторы (VID/PID)) and consistent masculine agreement for AltShift. Invariant values (app_name, ime_name, English, Русский, ADB command, and diagnostic formats) are marked translatable="false".
  • In-app selector & Android 13+ sync: A toolbar language button opens a System default / English / Русский picker backed by AppLanguage and LocaleController (AppCompatDelegate.setApplicationLocales()). android:localeConfig="@xml/locales_config" and AppLocalesMetadataHolderService (autoStoreLocales=true) persist the choice and keep it synced with Settings → System → Languages → App languages.
  • Non-Activity localization: LocaleController.localizedContext() checks the context's active configuration locale and rebuilds a configuration context when a long-lived Application or service context holds an outdated locale (falling back to LocaleManager.getApplicationLocales() on API 33+ when no AppCompat delegate is attached). LocaleController.refreshLocalizedNotifications() recreates notification channels and updates any active watchdog or safety-warning notification immediately on language change.

📐 Responsive Layouts, Theme & Notification Fixes

  • Material 3 IME fallback fix: ThemeController.themedContext() unifies localization and persisted ThemeMode resolution with ContextThemeWrapper(..., R.style.Theme_AltShift) for both KeyboardPromptOverlay and HardwareInputService.onCreateInputView(), eliminating the Material attribute InflateException under Theme.DeviceDefault.InputMethod (with a guarded plain TextView fallback).
  • Full expanded notifications (BigTextStyle): KeyboardNotification, KeyboardWarningNotification, and KeyboardWatchdogService now attach Notification.BigTextStyle().bigText(body) using framework APIs (minSdk 26), preventing 2-line ... truncation on expanded notifications across phone and tablet widths.
  • Toolbar status badge & tablet proportions: The status badge sits on its own row below the toolbar with wrap_content height (minHeight="30dp"), 6dp vertical padding, and no ellipsize cap, fitting Клавиатура отключена · IME неактивен and Keyboard disconnected · IME inactive in full at 360dp. Dashboard content reuses onboarding_content_side_margin (0dp phones, 48dp sw600dp, 96dp sw800dp, 240dp sw800dp landscape) so cards stay centered on wide screens.
  • Adaptive controls & Dynamic Island: Phone hotkey rows (item_hotkey.xml) stack the key badge below the app name while layout-sw600dp keeps it right-aligned; the language shortcut auto-sizes (16sp–22sp, 2 lines); buttons allow 2 lines with 48dp minimum height. The Dynamic Island uses 12dp/16dp outer horizontal padding, allows 2-line wrapping without ellipsis on phones (520dp landscape cap), and keeps the single-line 420dp capsule on sw600dp+.
  • Dialogs & onboarding: Added values-land tuning (72dp icon, reduced vertical padding) for 360dp-high landscape onboarding, adaptive screen-height sizing (160dp–360dp/420dp) for AppPickerDialog, scrollable landscape-safe KeyCaptureDialog, and tightened vertical spacing in AboutDialog so all diagnostics fit before scrolling at 360dp.

🧪 Build, Tests & Verification

  • Version & toolchain: versionCode 12, versionName '0.5.0' (AltShift-v0.5.0.apk / AltShift-v0.5.0-debug.apk). Toolchain unchanged: minSdk 26, targetSdk 34, Java 21, Gradle 8.9, AGP 8.7.3.
  • Docs updated: README.md and STYLEGUIDE.md (§5.4–5.5 and review checklist) updated to reflect per-app localization, BigTextStyle/themed contexts, and the responsive Dynamic Island conventions.
  • Automated checks: ./gradlew clean test lintDebug assembleDebug and post-merge ./gradlew test lintDebug assembleDebug passed with 52 JVM tests (including new AppLanguageTest, LocaleControllerTest, and ThemeControllerTest) and zero Android Lint issues.
  • Device verification (Lenovo TB710FU, Android 16, 2000×3200 @ 400 dpi): Verified in English and Russian, Light and Dark themes, across sw800dp (portrait/landscape), sw600dp, 411dp, and 360dp (portrait/landscape) with uiautomator truncation audits (0 unwanted ellipses/overlaps). Verified live on-device: Material 3 IME fallback rendering (ru Dark & en Light, 800dp & 360dp), KeyboardWarningNotification and KeyboardWatchdogService localization + full BigTextStyle extras, and AboutDialog fit at 360dp.
  • Remaining manual checks: Physical pogo-pin reattach end-to-end trigger and non-Lenovo OEM per-app language settings.

📥 Installation

Asset Description
AltShift-v0.5.0.apk Release build, R8-minified, signed with the CI release keystore.
AltShift-v0.5.0-debug.apk Debug build, unminified, signed with the local debug key.
adb install -r AltShift-v0.5.0.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

  • Single APK: Both en and ru resources ship in the single APK without Play Core downloads or language splits.
  • Cached notification channels: Recreating channels after a language change updates their labels unless the user has manually customized a channel name in system settings.
  • 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.5.0.apk)


Full Changelog: v0.4.4...v0.5.0

v0.4.4

Choose a tag to compare

@github-actions github-actions released this 13 Nov 16:32
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

v0.4.2

Choose a tag to compare

@github-actions github-actions released this 12 Nov 17:52
eb91206

AltShift v0.4.2 — patch release for Android 8.0+ since v0.4.1. It resolves blocked or delayed input-method switches caused by active Android 14+ stylus handwriting sessions and strips proprietary Google Play dependency metadata from distributed APKs for clean sideload, F-Droid, and scanner inspection. Transliteration, hotkeys, onboarding, notifications, and battery-optimization behavior are unchanged.


🖊️ Stylus Handwriting Session Teardown

  • InputMethodSwitcher.resetStylusHandwritingSession(Context): Releases an active stylus handwriting session before switching IMEs. Returns early below Android 14 (API 34 / UPSIDE_DOWN_CAKE), leaving the minSdk 26 path untouched.
  • IME & client teardown: Calls InputMethodService.finishStylusHandwriting() directly when running on the IME context. From an Activity, posts to the decor view once a window token is attached and calls InputMethodManager.hideSoftInputFromWindow(token, 0) to dismiss sessions held by other keyboards such as Gboard.
  • Lifecycle & exception guards: Skips finishing/destroyed activities, missing window tokens, or unavailable InputMethodManager instances, and wraps platform calls in try/catch (RuntimeException) with Log.w so device-specific handwriting implementations cannot crash switching.
  • Attach & picker integration: KeyboardMonitor.applyKeyboardAttached() queues the teardown on the main handler upon hardware keyboard attach, and SwitchBackActivity.onCreate() runs it before opening the system IME picker so Gboard's handwriting window cannot suppress the picker.

📦 Clean APK Metadata

  • dependenciesInfo disabled: app/build.gradle sets includeInApk = false and includeInBundle = false, removing the proprietary Play PKDS metadata block from APK signatures and App Bundles.
  • Packaging-only scope: Application code, runtime dependencies, permissions, resources, and the minSdk/targetSdk contract are unchanged.

🧪 Build, Tests & Verification

  • Version & docs: versionCode 9, versionName '0.4.2' (AltShift-v0.4.2.apk / AltShift-v0.4.2-debug.apk). Toolchain unchanged (minSdk 26, targetSdk 34, Java 21, Gradle 8.9, AGP 8.7.3). Removed the hardcoded Version-0.4.1 badge from README.md (retaining the dynamic Release badge); RELEASE-NOTES.md stays local/untracked; no architecture, DI, storage, or model changes.
  • Automated checks: ./gradlew test lintDebug and ./gradlew assembleDebug passed (BUILD SUCCESSFUL), gated by the existing ModelTest, TransliterationTableTest, ThemeModeTest, and KeyLabelFormatterTest JVM suites (no new instrumentation tests added).
  • Remaining manual checks: Android ≤13 early-return behavior, and verifying PKDS metadata removal via apksigner verify --print-certs / APK analyzer.

📥 Installation

Asset Description
AltShift-v0.4.2.apk Release build, R8-minified, signed with the CI release keystore.
AltShift-v0.4.2-debug.apk Debug build, unminified, signed with the local debug key.
adb install -r AltShift-v0.4.2.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

  • Android 14+ & owner/client scope: finishStylusHandwriting() requires API 34+ (no-op on Android 8.0–13). AltShift finishes its own session directly, while third-party IMEs rely on hideSoftInputFromWindow() once a decor window token exists; OEM handwriting keyboards may vary and require device verification.
  • Packaging-only metadata change: Disabling dependenciesInfo strips PKDS metadata without altering signing, permissions, or runtime behavior.
  • No v0.4.1 regressions or backup changes: Onboarding, notifications, transliteration, hotkeys, and Dynamic Island geometry are untouched, and allowBackup="false" resets preferences on uninstall or pm clear.

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


Full Changelog: v0.4.1...v0.4.2

v0.4.1

Choose a tag to compare

@github-actions github-actions released this 11 Nov 16:17
c7c01c3

AltShift v0.4.1 — patch release for Android 8.0+ since v0.4. It adds a first-class battery optimization exemption flow to the onboarding wizard so the IME and keyboard monitor survive Doze and OEM process killers during long idle periods, rebuilds Step 3 as a Material 3 permission card with an in-app rationale dialog, fixes live Step 2 IME selection and cold-start auto-switch conflicts, constrains onboarding content to a readable tablet column, and makes Re-run Setup Wizard start from Step 1. No input, transliteration, or hotkey behavior changed.


🔋 Background Execution & Doze

  • BatteryHelper (ru.b1sted.altshift.util.BatteryHelper): isIgnoringBatteryOptimizations() queries PowerManager.isIgnoringBatteryOptimizations(packageName) (treating a missing power service as restricted). requestIgnoreBatteryOptimizations() launches Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS with a package: URI and falls back sequentially to ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS if the OEM hides the per-package dialog.
  • Manifest & safety guards: Declares REQUEST_IGNORE_BATTERY_OPTIMIZATIONS in AndroidManifest.xml (annotated with BatteryLife lint suppression; treated as user-revocable, never permanent), adds FLAG_ACTIVITY_NEW_TASK only for non-Activity contexts, and wraps intent launches in try/catch (RuntimeException) with Log.w.
  • Doze scope: Moves AltShift out of standard Doze/App Standby restrictions during multi-day idle periods while leaving IME binding, KeyboardMonitor, and boot recovery unchanged.

🎨 Onboarding & Permission UX

  • Step 3 Material 3 card: Displays Overlay access, Notifications, and Background execution with colored status dots. ALLOW BACKGROUND RUNNING and its description appear only while restricted, collapsing to ✓ Unrestricted (brand_success) once granted.
  • In-app rationale & resume refresh: Tapping ALLOW BACKGROUND RUNNING opens a Material 3 rationale dialog (CONTINUE triggers the system prompt; CANCEL leaves state untouched), and OnboardingActivity.onResume() re-reads BatteryHelper to update the card immediately on return.
  • Live Step 2 selection & cold-start guard: Registers a ContentObserver on Settings.Secure.DEFAULT_INPUT_METHOD (onStart–onStop) plus onWindowFocusChanged(), updating the row to AltShift is the active keyboard / CONTINUE without requiring a second tap. HardwareInputService.setAutoSwitchSuppressed(true) while the wizard is active keeps KeyboardMonitor.applyKeyboardDetached() from immediately switching back to the soft keyboard when no hardware keyboard is attached.
  • Rerun & preserved flows: EXTRA_RERUN (About → Re-run Setup Wizard) always starts at STEP_ENABLE (Step 1), while first-time launches resume at the first incomplete step. Overlay (ACTION_MANAGE_OVERLAY_PERMISSION) and Android 13+ notification (POST_NOTIFICATIONS) flows are preserved.

📱 Responsive Layout

  • Readable tablet measure: Constrains titles, descriptions (640dp max text measure), and the permission card to a centered column via onboarding_content_side_margin (0dp phones, 48dp sw600dp, 96dp sw800dp, 240dp sw800dp-land) rather than stretching across 1280dp displays.
  • Centered layout & Material 3 widgets: fillViewport with gravity="center" balances all three steps (Step 3 fits without scrolling at 1280×800dp and scrolls cleanly at larger font scales), using a 96dp icon, 16dp card radius/padding, 12dp dividers, and existing MaterialCardView/MaterialButton/bg_status_dot components.

🧪 Build, Tests & Verification

  • Version & docs: versionCode 8, versionName '0.4.1' (AltShift-v0.4.1.apk / AltShift-v0.4.1-debug.apk). Toolchain unchanged (minSdk 26, targetSdk 34, Java 21, Gradle 8.9, AGP 8.7.3). Added the Version-0.4.1 badge and background-execution summary to README.md; RELEASE-NOTES.md remains local/untracked; additive change with no DI or architecture modifications.
  • Automated checks: ./gradlew test lintDebug and ./gradlew assembleDebug passed (BUILD SUCCESSFUL), gated by the existing ModelTest, TransliterationTableTest, ThemeModeTest, and KeyLabelFormatterTest JVM suites (no instrumentation tests added).
  • Device verification (Lenovo TB710FU, Android 16 ZUI, ADB): Verified Steps 1–3 in portrait/landscape, Re-run Setup Wizard starting at Step 1, rationale → native prompt → ✓ Unrestricted (dumpsys deviceidle whitelist confirmed user,ru.b1sted.altshift), live Step 2 picker update to CONTINUE, and cold-start OnboardingActivity launch with Gboard active and no hardware keyboard attached (present=false without auto-switching back). System exemption dialog, Settings fallback, and OEM battery-manager behavior remain manually verified.

📥 Installation

Asset Description
AltShift-v0.4.1.apk Release build, R8-minified, signed with the CI release keystore.
AltShift-v0.4.1-debug.apk Debug build, unminified, signed with the local debug key.
adb install -r AltShift-v0.4.1.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

  • System dialog contrast & Settings toggle: The native Let app always run in background? prompt (com.android.settings) shows low-contrast body text in Android 16 dark mode (ZUI), mitigated by AltShift's pre-dialog rationale. On verified firmware, App battery usage → Allow background usage does not populate deviceidle whitelist—only the native prompt or cmd deviceidle whitelist makes isIgnoringBatteryOptimizations() return true.
  • OEM process killers & revocability: Exemption covers AOSP Doze/App Standby, while vendor task killers can still intervene (lock AltShift in Recents on ZUI for multi-day idle survival); users can revoke the exemption at any time and the onboarding row only reflects state.
  • Distribution & manual scope: REQUEST_IGNORE_BATTERY_OPTIMIZATIONS targets sideload/F-Droid builds (a Play-distributed build should use the settings-list fallback); Settings intent resolution and OEM battery UI are verified manually rather than by instrumentation tests.
  • No v0.4 input-path or backup changes: Transliteration, hotkeys, Dynamic Island geometry, notification channels, and keyboard monitor behavior are untouched, and allowBackup="false" resets preferences, WRITE_SECURE_SETTINGS, and the battery exemption on uninstall or pm clear.

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


Full Changelog: v0.4...v0.4.1

v0.4

Choose a tag to compare

@github-actions github-actions released this 10 Nov 21:26
8fb245a

AltShift v0.4 — hardware keyboard driver release for Android 8.0+ since v0.3.2. It replaces the previous foreground-service switching loop with a process-wide KeyboardMonitor, making detach switching independent of WRITE_SECURE_SETTINGS via IME-session APIs and adopting a 100% universal AOSP architecture with no hardcoded Gboard or OEM branches. It also introduces the 420dp tablet Dynamic Island, SwitchBackActivity picker trampoline, standardized IMPORTANCE_HIGH notification channels, a single-IME lockout warning, an About dialog with live hardware diagnostics, and a decoupled test/release CI pipeline.


🚀 Switching Core, IME Session & Universal AOSP

  • HardwareInputService.KeyboardMonitor: Moves input-device monitoring out of the deleted KeyboardSwitchService foreground service (removing FOREGROUND_SERVICE / FOREGROUND_SERVICE_SPECIAL_USE and the disconnect deadlock) into an application-scoped singleton on a dedicated AltShift-Input HandlerThread. Observes InputDeviceListener and DEFAULT_INPUT_METHOD / ENABLED_INPUT_METHODS with a 150 ms debounce, surviving IME unbinding via WeakReference<HardwareInputService>.
  • Permission-independent detach & AOSP resolution: switchToSoftKeyboardFromIme() tries switchToPreviousInputMethod() (API 28+) then switchInputMethod(resolveSoftKeyboardId()) without requiring WRITE_SECURE_SETTINGS. resolveSoftKeyboardId() picks persisted previous_input_method (if enabled) or the first enabled non-AltShift IME—eliminating the hardcoded com.google.android.inputmethod.latin lookup.
  • Presence detection & boot guard: Splits cost between main-thread-safe isPhysicalKeyboardReported() and off-main-thread findPhysicalKeyboard() (enabled, non-virtual SOURCE_KEYBOARD without SOURCE_TOUCHSCREEN, plus KEYBOARD_TYPE_ALPHABETIC on API 28+). BootReceiver starts the monitor only when auto-switch is enabled and at least one recovery path (WRITE_SECURE_SETTINGS, overlay, or notifications) is available.
  • Fallback view & crash containment: view_ime_fallback renders only while detached (stranded hides "Switch keyboard" and shows "Open Keyboard Settings"); launchHotkeyApp() keeps zero-allocation array scanning; all IME writes serialize on SWITCH_LOCK with live hasSecureSettingsPermission() checks and try/catch (RuntimeException) isolation across InputConnection, Settings.Secure, WindowManager, and notifications.

🎨 Dynamic Island, Picker Trampoline & Dashboard

  • KeyboardPromptOverlay: Bottom-center TYPE_APPLICATION_OVERLAY capsule (minWidth=420dp, 24dp above WindowInsets bottom on API 30+ / navigation_bar_height on API 26–29) with 12,000 ms auto-dismiss, synchronous shown reset in dismiss() / removeFailedView(), and callback reuse on repeated show().
  • SwitchBackActivity trampoline: Transparent singleInstance (noHistory, excludeFromRecents, FLAG_NOT_TOUCHABLE) activity hosting a 1×1 InputClientView so showInputMethodPicker() succeeds after a 200 ms delay. Focus return posts the inactive alert only after deliberate picker dismissal; a 15 s timeout exits silently, and dismissing the Dynamic Island never notifies.
  • About diagnostics, onboarding & dashboard: AboutDialog shows BuildConfig version and off-main-thread InputDevice diagnostics (Unavailable on error) with GitHub and EXTRA_RERUN actions; onboarding gates Steps 1–2 if no alternative IME is enabled; MainActivity polls hasSecureSettingsPermission() (1,000 ms while resumed + onWindowFocusChanged()) and observes DEFAULT_INPUT_METHOD (removing the EXTRA_OPEN_IME_PICKER resume hack).

🛡️ Notifications & CI/CD

  • Canonical channels & alerts: NotificationChannels.initialize() creates IMPORTANCE_HIGH altshift_keyboard_alerts and altshift_safety_warnings on startup while deleting six legacy IDs (auto_switch, keyboard_state*, warning_channel*). KeyboardWarningNotification (ID 2001) warns when AltShift is the sole enabled IME; KeyboardNotification (ID 1001) posts from SwitchBackActivity.onPickerDismissed() and clears on detach or AltShift reactivation.
  • Decoupled CI/CD & R8 signing: .github/workflows/build.yml splits test (./gradlew test lintDebug, JDK 21) and tag-gated release (KEYSTORE_BASE64, assembleDebug assembleRelease, softprops/action-gh-release@v2). app/build.gradle enables R8 + shrinkResources, env-based signingConfigs.release, and AltShift-v<version>.apk artifact naming.

🧪 Build, Tests & Verification

  • Version & toolchain: versionCode 7, versionName '0.4' (AltShift-v0.4.apk / AltShift-v0.4-debug.apk). Toolchain: minSdk 26, targetSdk 34, Java 21, Gradle 8.9, AGP 8.7.3.
  • Automated checks: CI gates on ./gradlew test lintDebug covering ModelTest (cosmetic final cleanup only), TransliterationTableTest, ThemeModeTest, and KeyLabelFormatterTest JVM suites.
  • Manual verification scope: KeyboardMonitor debounce, overlay lifecycle, focus-based picker detection, channel migration, and permission revocation have no instrumentation tests and were verified manually across API 26–34.

📥 Installation

Asset Description
AltShift-v0.4.apk Release build, R8-minified, signed with the CI release keystore.
AltShift-v0.4-debug.apk Debug build, unminified, signed with the local debug key.
adb install -r AltShift-v0.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

Note: Debug and release APKs use different signing keys (adb uninstall ru.b1sted.altshift is required when switching between them). Uninstalling wipes altshift_prefs (allowBackup="false") and revokes WRITE_SECURE_SETTINGS; without it, detach still works via IME-session switching while reattach uses the Dynamic Island or notification.


🔨 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

  • Permission-gated recovery: Dynamic Island requires SYSTEM_ALERT_WINDOW; inactive/lockout alerts require POST_NOTIFICATIONS on Android 13+; autonomous attach switching requires WRITE_SECURE_SETTINGS (without it, reattach relies on the Dynamic Island, notification, or fallback view).
  • Picker & API-level fallbacks: SwitchBackActivity infers picker dismissal from focus return (OEM choosers that keep focus hit the 15 s silent timeout; the 200 ms delay targets AOSP). API 26–29 uses navigation_bar_height for overlay positioning, and API 26–27 cannot filter KEYBOARD_TYPE_ALPHABETIC.
  • Safety check & fixed UI scope: hasAlternativeInputMethod() is capability-blind (treats any enabled non-AltShift IME as a fallback); Dynamic Island placement (420dp minWidth, bottom-center, 12 s timeout) is fixed; ЙЦУКЕН remains the only non-Latin layout.
  • Test scope & state wipe: New runtime behaviors are manually verified rather than instrumentation-tested, and allowBackup="false" resets preferences, WRITE_SECURE_SETTINGS, and the remembered IME on uninstall or pm clear.

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


Full Changelog: v0.3.2...v0.4

v0.3.2

Choose a tag to compare

@github-actions github-actions released this 09 Nov 18:41
dcd97a8

AltShift v0.3.2 — the first public release of AltShift for Android 8.0+, packaging the complete feature set accumulated across v0.1–v0.3.1. It delivers signed release distribution, deterministic build artifacts, an allocation-free Russian ЙЦУКЕН transliteration pipeline, event-driven automatic IME switching, a fullscreen onboarding wizard, and Light/Dark/System themes in pure Java 21 with zero Kotlin, DI, or cloud telemetry.


⌨️ Russian Transliteration & Input Pipeline

  • Allocation-free TransliterationTable: Maps key codes to Cyrillic via primitive-indexed static arrays, resolving Shift and CapsLock at lookup time without iterators, string concatenation, or runtime allocations on the typing path.
  • Full Russian PC layout & CapsLock isolation: Emulates desktop ЙЦУКЕН punctuation and the physical number row (!, ", №, ;, %, :, ?, *, (, )). CapsLock inversion applies strictly to alphabetic keys while keeping digits and symbols unaffected.
  • Language toggle & app hotkeys: Alt + Shift toggles Russian mode by default (captured from the next physical combination in UI, matched in either modifier order, bypassing OS subtype switching). Application hotkeys match modifier masks + key codes on initial key-down (repeatCount == 0) via launcher intents before transliteration.
  • Pass-through & fail-safe service: Unmapped/out-of-range keys, Ctrl/Meta chords, and events when Russian mode is off pass through unchanged. External intents, InputConnection calls, and device lookups are guarded so IME exceptions cannot take down system input.

🔄 Automatic IME Switching

  • Physical keyboard detection & foreground monitor: KeyboardPresenceMonitor checks KEYBOARD_NOKEYS/hardKeyboardHidden and enumerates InputManager devices (excluding virtual and touchscreen-only devices; KEYBOARD_TYPE_ALPHABETIC on API 29+). KeyboardSwitchService runs as an event-driven specialUse foreground service listening to InputDeviceListener callbacks rather than polling.
  • Secure-settings switching & fallbacks: With WRITE_SECURE_SETTINGS, InputMethodSwitcher updates Settings.Secure.DEFAULT_INPUT_METHOD directly, remembers the previous soft keyboard, and restores it on detach. Without it, AltShift falls back to a one-tap reconnection notification or the system picker (previous/next guarded to API 28+).
  • Soft-keyboard suppression & reboot recovery: onShowInputRequested() returns false while a physical keyboard is attached; BootReceiver restarts KeyboardSwitchService after BOOT_COMPLETED when auto-switching is enabled and WRITE_SECURE_SETTINGS is granted.

🎨 Onboarding, UI & Architecture

  • Fullscreen onboarding & Material 3 dashboard: A three-step wizard verifies IME enablement, active selection, overlay access, and runtime POST_NOTIFICATIONS (Android 13+) with one-tap actions and hardened notification icons. Native XML views provide a toolbar status badge, language-shortcut card, auto-switch controls, hotkey list, key-capture dialog, and RecyclerView app picker, with persisted Light/Dark/System themes (root overdraw removed).
  • Pure Java 21 & zero-bloat storage: Uses AppCompat, Material 3, RecyclerView, SharedPreferences, and org.json only—no Kotlin, Compose, DI, or annotation processors. All settings and hotkeys stay strictly local per package, vanish on uninstall, and guard platform calls individually against OEM restrictions.

🧪 Build, CI/CD & Tests

  • Signed CI & deterministic artifacts: versionCode 5, versionName '0.3.2' (minSdk 26, targetSdk 34, Java 21, Groovy DSL, pinned Gradle wrapper). applicationVariants names outputs AltShift-v0.3.2.apk and AltShift-v0.3.2-debug.apk. GitHub Actions (actions/setup-java@v5, Temurin 21, Gradle cache) decodes KEYSTORE_BASE64 into app/release.jks (always removed in cleanup), builds both variants, uploads artifacts, and publishes tags via softprops/action-gh-release. Added git-ignored local wrapper template scripts/build-release.sh.example.
  • JVM test suite: Covers TransliterationTable (lower/upper letters, CapsLock inversion on letters vs isolation on digits/symbols, punctuation, Russian number row, null/out-of-range keys), hotkey matching (modifier masks, order equivalence, language shortcut, null package, unknown key codes, persistence round-trips), KeyLabelFormatter, and ThemeMode parsing/fallbacks.

📥 Installation

Asset Description
AltShift-v0.3.2.apk Signed release build — recommended.
AltShift-v0.3.2-debug.apk Debug build signed with the local debug key.
adb install -r AltShift-v0.3.2.apk
adb shell ime enable ru.b1sted.altshift/.service.HardwareInputService
adb shell ime set ru.b1sted.altshift/.service.HardwareInputService

Optional autonomous switching (also configurable via Settings → System → Languages & input → On-screen keyboard):

adb shell pm grant ru.b1sted.altshift android.permission.WRITE_SECURE_SETTINGS

Note: Distributed via GitHub Releases (not Google Play). Debug and release APKs use different signing keys—uninstall the debug build (adb uninstall ru.b1sted.altshift) before switching, which also clears local configuration.


🔨 Building from Source

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

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

⚠️ Notes & Limitations

  • No on-screen keyboard: AltShift does not draw a soft keyboard; use the system IME or automatic fallback when no physical keyboard is attached.
  • Permission-scoped switching: Without WRITE_SECURE_SETTINGS, automatic switching is limited to the reconnection notification prompt or the system keyboard picker.
  • App picker scope: Only components with a launcher activity appear in the application picker for hotkey binding.
  • Incompatible signing keys: Release builds cannot update a debug installation in place without uninstalling first.

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


Full Changelog: v0.1...v0.3.2