Repository navigation
Releases
v0.5.0
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-rutranslation: 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 markedtranslatable="false". - In-app selector & Android 13+ sync: A toolbar language button opens a System default / English / Русский picker backed by
AppLanguageandLocaleController(AppCompatDelegate.setApplicationLocales()).android:localeConfig="@xml/locales_config"andAppLocalesMetadataHolderService(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-livedApplicationor service context holds an outdated locale (falling back toLocaleManager.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 persistedThemeModeresolution withContextThemeWrapper(..., R.style.Theme_AltShift)for bothKeyboardPromptOverlayandHardwareInputService.onCreateInputView(), eliminating the Material attributeInflateExceptionunderTheme.DeviceDefault.InputMethod(with a guarded plainTextViewfallback). - Full expanded notifications (
BigTextStyle):KeyboardNotification,KeyboardWarningNotification, andKeyboardWatchdogServicenow attachNotification.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_contentheight (minHeight="30dp"),6dpvertical padding, and noellipsizecap, fittingКлавиатура отключена · IME неактивенandKeyboard disconnected · IME inactivein full at360dp. Dashboard content reusesonboarding_content_side_margin(0dpphones,48dpsw600dp,96dpsw800dp,240dpsw800dplandscape) 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 whilelayout-sw600dpkeeps it right-aligned; the language shortcut auto-sizes (16sp–22sp, 2 lines); buttons allow 2 lines with48dpminimum height. The Dynamic Island uses12dp/16dpouter horizontal padding, allows 2-line wrapping without ellipsis on phones (520dplandscape cap), and keeps the single-line420dpcapsule onsw600dp+. - Dialogs & onboarding: Added
values-landtuning (72dpicon, reduced vertical padding) for360dp-high landscape onboarding, adaptive screen-height sizing (160dp–360dp/420dp) forAppPickerDialog, scrollable landscape-safeKeyCaptureDialog, and tightened vertical spacing inAboutDialogso all diagnostics fit before scrolling at360dp.
🧪 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.mdandSTYLEGUIDE.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 assembleDebugand post-merge./gradlew test lintDebug assembleDebugpassed with 52 JVM tests (including newAppLanguageTest,LocaleControllerTest, andThemeControllerTest) and zero Android Lint issues. - Device verification (Lenovo TB710FU, Android 16,
2000×3200@400 dpi): Verified in English and Russian, Light and Dark themes, acrosssw800dp(portrait/landscape),sw600dp,411dp, and360dp(portrait/landscape) withuiautomatortruncation audits (0unwanted ellipses/overlaps). Verified live on-device: Material 3 IME fallback rendering (ruDark &enLight,800dp&360dp),KeyboardWarningNotificationandKeyboardWatchdogServicelocalization + fullBigTextStyleextras, andAboutDialogfit at360dp. - 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.HardwareInputServiceOptional 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.altshiftNote: Debug and release APKs use different signing keys (
adb uninstall ru.b1sted.altshiftis required when switching between them). Uninstalling clearsaltshift_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
enandruresources 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 orpm clear.
🛡️ Security & Analysis (AltShift-v0.5.0.apk)
- VirusTotal: Scan report
- Pithus: Static analysis
Full Changelog: v0.4.4...v0.5.0
v0.4.4
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 viastopSelf()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_IMMEDIATEon API 31+), showing "Waiting for physical keyboard" when detached and "Monitoring keyboard connection" while attached with another IME active. Updates vianotify()only on state changes; uses zero polling, timers, or wake locks, with guardedstartForegroundService()/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 withpresent = trueand shows the Dynamic Island again. USER_PRESENTwake-up: Handled in the manifest and via a process-local receiver registered inAltShiftApplication.onCreate()(RECEIVER_EXPORTEDon 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:
KeyboardPromptOverlayapplies the persistedThemeMode(LIGHT/DARK/FOLLOW_SYSTEM) before inflating, uses dedicatedprompt_surface(#F4F3FA/#252630) andprompt_stroke(#1F1B1B21/#24FFFFFF) tokens, applies explicitsetImageTintList()for icons, and renders a4dpshadow inside clip-free24dp/14dp/28dppadding aty = max(0, bottomInset() - 20dp). - Phone & tablet sizing: Phones use the inset width (
0dpminWidth) and ellipsize the message before clipping actions;sw600dp+uses an exact420dpcapsule with Switch back and[X]pinned to the right12dpedge. 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 dismissibleIMPORTANCE_DEFAULTreminder onaltshift_keyboard_alerts_v2; cancelling the system IME picker fromSwitchBackActivitywithout selecting AltShift posts anIMPORTANCE_HIGHheads-up onaltshift_keyboard_alerts_urgent(withoutsetOnlyAlertOnce(true)). Cancelled automatically when AltShift activates or the keyboard detaches.
🔐 Permissions, Performance & Integrity
QUERY_ALL_PACKAGESremoved: Replaced with a narrow launcher<queries>block. Still declares noINTERNETpermission; addsFOREGROUND_SERVICEandFOREGROUND_SERVICE_SPECIAL_USE.- Off-main-thread UI & lazy icons: Onboarding IME checks and app-picker label queries run on background executors.
AppPickerDialogandHotkeyAdaptermigrate toListAdapter+DiffUtiland decode icons lazily per bound row with boundedLruCaches (48/32entries, 2 daemon threads) and clean teardown. - Shortcut conflict prevention: Pure-JVM
HotkeyBindingStoreandHotkeyBinding.conflictsWith()prevent app hotkeys and the language switch from sharing a combination (with modifier-order equivalence). - Lifecycle & guidance:
BootReceiverfilters strictly forBOOT_COMPLETED/USER_PRESENT;HardwareInputServicereconciles the watchdog on IME release and logs nullInputConnectionreturns; 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 obsoletebg_prompt_pill.xml; updatedREADME.md(with measured memory/CPU breakdown) andSTYLEGUIDE.md(watchdog,USER_PRESENT,≤ 64 MBPSS budget, overlay, and alert contracts). - Automated checks:
./gradlew clean test lintDebug assembleDebugand post-merge./gradlew test lintDebug assembleDebugpassed with 0 Lint issues and expandedHotkeyBindingStoreTestandModelTestJVM suites. - Device verification (Lenovo TB710FU, Android 16, 2000×3200, 400 dpi, debug APK):
- Typing (active IME):
2041 KBJava heap,7382 KBnative heap,41773 KBTotal PSS,0 KBGraphics, 0.0% idle CPU. - Standby watchdog (detached):
3629 KBJava heap,9171 KBnative heap,52601 KBTotal PSS,0 KBGraphics, 0.0% idle CPU. - App picker peak:
5153 KBJava heap,50832 KBnative heap,360592 KBTotal PSS. - Verified Light/Dark Dynamic Island override,
420dptablet alignment,8dpinset clearance, 12s timeout and[X]standard reminders, cancelled-picker heads-up alert, and physical pogo-pin detach/reattach transitions.
- Typing (active IME):
- 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.HardwareInputServiceOptional 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.altshiftNote: Debug and release APKs use different signing keys (
adb uninstall ru.b1sted.altshiftis required when switching between them). Uninstalling clearsaltshift_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
specialUseinstead ofconnectedDeviceto 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 orpm clear.
🛡️ Security & Analysis (AltShift-v0.4.4.apk)
- VirusTotal: Scan report
- Pithus: Static analysis
Full Changelog: v0.4.2...v0.4.4
v0.4.2
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 theminSdk 26path untouched.- IME & client teardown: Calls
InputMethodService.finishStylusHandwriting()directly when running on the IME context. From anActivity, posts to the decor view once a window token is attached and callsInputMethodManager.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
InputMethodManagerinstances, and wraps platform calls intry/catch (RuntimeException)withLog.wso device-specific handwriting implementations cannot crash switching. - Attach & picker integration:
KeyboardMonitor.applyKeyboardAttached()queues the teardown on the main handler upon hardware keyboard attach, andSwitchBackActivity.onCreate()runs it before opening the system IME picker so Gboard's handwriting window cannot suppress the picker.
📦 Clean APK Metadata
dependenciesInfodisabled:app/build.gradlesetsincludeInApk = falseandincludeInBundle = 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/targetSdkcontract 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 hardcodedVersion-0.4.1badge fromREADME.md(retaining the dynamicReleasebadge);RELEASE-NOTES.mdstays local/untracked; no architecture, DI, storage, or model changes. - Automated checks:
./gradlew test lintDebugand./gradlew assembleDebugpassed (BUILD SUCCESSFUL), gated by the existingModelTest,TransliterationTableTest,ThemeModeTest, andKeyLabelFormatterTestJVM 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.HardwareInputServiceOptional 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.altshiftNote: Debug and release APKs use different signing keys (
adb uninstall ru.b1sted.altshiftis required when switching between them). Uninstalling clearsaltshift_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 onhideSoftInputFromWindow()once a decor window token exists; OEM handwriting keyboards may vary and require device verification. - Packaging-only metadata change: Disabling
dependenciesInfostrips 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 orpm clear.
🛡️ Security & Analysis (AltShift-v0.4.2.apk)
- VirusTotal: Scan report
- Pithus: Static analysis
Full Changelog: v0.4.1...v0.4.2
v0.4.1
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()queriesPowerManager.isIgnoringBatteryOptimizations(packageName)(treating a missing power service as restricted).requestIgnoreBatteryOptimizations()launchesSettings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONSwith apackage:URI and falls back sequentially toACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGSif the OEM hides the per-package dialog.- Manifest & safety guards: Declares
REQUEST_IGNORE_BATTERY_OPTIMIZATIONSinAndroidManifest.xml(annotated withBatteryLifelint suppression; treated as user-revocable, never permanent), addsFLAG_ACTIVITY_NEW_TASKonly for non-Activitycontexts, and wraps intent launches intry/catch (RuntimeException)withLog.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, andBackground executionwith colored status dots.ALLOW BACKGROUND RUNNINGand its description appear only while restricted, collapsing to✓ Unrestricted(brand_success) once granted. - In-app rationale & resume refresh: Tapping
ALLOW BACKGROUND RUNNINGopens a Material 3 rationale dialog (CONTINUEtriggers the system prompt;CANCELleaves state untouched), andOnboardingActivity.onResume()re-readsBatteryHelperto update the card immediately on return. - Live Step 2 selection & cold-start guard: Registers a
ContentObserveronSettings.Secure.DEFAULT_INPUT_METHOD(onStart–onStop) plusonWindowFocusChanged(), updating the row toAltShift is the active keyboard/CONTINUEwithout requiring a second tap.HardwareInputService.setAutoSwitchSuppressed(true)while the wizard is active keepsKeyboardMonitor.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 atSTEP_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 (
640dpmax text measure), and the permission card to a centered column viaonboarding_content_side_margin(0dpphones,48dpsw600dp,96dpsw800dp,240dpsw800dp-land) rather than stretching across1280dpdisplays. - Centered layout & Material 3 widgets:
fillViewportwithgravity="center"balances all three steps (Step 3 fits without scrolling at1280×800dpand scrolls cleanly at larger font scales), using a96dpicon,16dpcard radius/padding,12dpdividers, and existingMaterialCardView/MaterialButton/bg_status_dotcomponents.
🧪 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 theVersion-0.4.1badge and background-execution summary toREADME.md;RELEASE-NOTES.mdremains local/untracked; additive change with no DI or architecture modifications. - Automated checks:
./gradlew test lintDebugand./gradlew assembleDebugpassed (BUILD SUCCESSFUL), gated by the existingModelTest,TransliterationTableTest,ThemeModeTest, andKeyLabelFormatterTestJVM suites (no instrumentation tests added). - Device verification (Lenovo TB710FU, Android 16 ZUI, ADB): Verified Steps 1–3 in portrait/landscape,
Re-run Setup Wizardstarting at Step 1, rationale → native prompt →✓ Unrestricted(dumpsys deviceidle whitelistconfirmeduser,ru.b1sted.altshift), live Step 2 picker update toCONTINUE, and cold-startOnboardingActivitylaunch with Gboard active and no hardware keyboard attached (present=falsewithout 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.HardwareInputServiceOptional 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.altshiftNote: Debug and release APKs use different signing keys (
adb uninstall ru.b1sted.altshiftis required when switching between them). Uninstalling clearsaltshift_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 usagedoes not populatedeviceidlewhitelist—only the native prompt orcmd deviceidle whitelistmakesisIgnoringBatteryOptimizations()returntrue. - 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_OPTIMIZATIONStargets 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 orpm clear.
🛡️ Security & Analysis (AltShift-v0.4.1.apk)
- VirusTotal: Scan report
- Pithus: Static analysis
Full Changelog: v0.4...v0.4.1
v0.4
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 deletedKeyboardSwitchServiceforeground service (removingFOREGROUND_SERVICE/FOREGROUND_SERVICE_SPECIAL_USEand the disconnect deadlock) into an application-scoped singleton on a dedicatedAltShift-InputHandlerThread. ObservesInputDeviceListenerandDEFAULT_INPUT_METHOD/ENABLED_INPUT_METHODSwith a150 msdebounce, surviving IME unbinding viaWeakReference<HardwareInputService>.- Permission-independent detach & AOSP resolution:
switchToSoftKeyboardFromIme()triesswitchToPreviousInputMethod()(API 28+) thenswitchInputMethod(resolveSoftKeyboardId())without requiringWRITE_SECURE_SETTINGS.resolveSoftKeyboardId()picks persistedprevious_input_method(if enabled) or the first enabled non-AltShift IME—eliminating the hardcodedcom.google.android.inputmethod.latinlookup. - Presence detection & boot guard: Splits cost between main-thread-safe
isPhysicalKeyboardReported()and off-main-threadfindPhysicalKeyboard()(enabled, non-virtualSOURCE_KEYBOARDwithoutSOURCE_TOUCHSCREEN, plusKEYBOARD_TYPE_ALPHABETICon API 28+).BootReceiverstarts 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_fallbackrenders only while detached (strandedhides "Switch keyboard" and shows "Open Keyboard Settings");launchHotkeyApp()keeps zero-allocation array scanning; all IME writes serialize onSWITCH_LOCKwith livehasSecureSettingsPermission()checks andtry/catch (RuntimeException)isolation acrossInputConnection,Settings.Secure,WindowManager, and notifications.
🎨 Dynamic Island, Picker Trampoline & Dashboard
KeyboardPromptOverlay: Bottom-centerTYPE_APPLICATION_OVERLAYcapsule (minWidth=420dp,24dpaboveWindowInsetsbottom on API 30+ /navigation_bar_heighton API 26–29) with12,000 msauto-dismiss, synchronousshownreset indismiss()/removeFailedView(), and callback reuse on repeatedshow().SwitchBackActivitytrampoline: TransparentsingleInstance(noHistory,excludeFromRecents,FLAG_NOT_TOUCHABLE) activity hosting a 1×1InputClientViewsoshowInputMethodPicker()succeeds after a200 msdelay. Focus return posts the inactive alert only after deliberate picker dismissal; a15 stimeout exits silently, and dismissing the Dynamic Island never notifies.- About diagnostics, onboarding & dashboard:
AboutDialogshowsBuildConfigversion and off-main-threadInputDevicediagnostics (Unavailableon error) with GitHub andEXTRA_RERUNactions; onboarding gates Steps 1–2 if no alternative IME is enabled;MainActivitypollshasSecureSettingsPermission()(1,000 mswhile resumed +onWindowFocusChanged()) and observesDEFAULT_INPUT_METHOD(removing theEXTRA_OPEN_IME_PICKERresume hack).
🛡️ Notifications & CI/CD
- Canonical channels & alerts:
NotificationChannels.initialize()createsIMPORTANCE_HIGHaltshift_keyboard_alertsandaltshift_safety_warningson startup while deleting six legacy IDs (auto_switch,keyboard_state*,warning_channel*).KeyboardWarningNotification(ID2001) warns when AltShift is the sole enabled IME;KeyboardNotification(ID1001) posts fromSwitchBackActivity.onPickerDismissed()and clears on detach or AltShift reactivation. - Decoupled CI/CD & R8 signing:
.github/workflows/build.ymlsplitstest(./gradlew test lintDebug, JDK 21) and tag-gatedrelease(KEYSTORE_BASE64,assembleDebug assembleRelease,softprops/action-gh-release@v2).app/build.gradleenables R8 +shrinkResources, env-basedsigningConfigs.release, andAltShift-v<version>.apkartifact 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 lintDebugcoveringModelTest(cosmeticfinalcleanup only),TransliterationTableTest,ThemeModeTest, andKeyLabelFormatterTestJVM suites. - Manual verification scope:
KeyboardMonitordebounce, 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.HardwareInputServiceOptional 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 allowNote: Debug and release APKs use different signing keys (
adb uninstall ru.b1sted.altshiftis required when switching between them). Uninstalling wipesaltshift_prefs(allowBackup="false") and revokesWRITE_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 requirePOST_NOTIFICATIONSon Android 13+; autonomous attach switching requiresWRITE_SECURE_SETTINGS(without it, reattach relies on the Dynamic Island, notification, or fallback view). - Picker & API-level fallbacks:
SwitchBackActivityinfers picker dismissal from focus return (OEM choosers that keep focus hit the15 ssilent timeout; the200 msdelay targets AOSP). API 26–29 usesnavigation_bar_heightfor overlay positioning, and API 26–27 cannot filterKEYBOARD_TYPE_ALPHABETIC. - Safety check & fixed UI scope:
hasAlternativeInputMethod()is capability-blind (treats any enabled non-AltShift IME as a fallback); Dynamic Island placement (420dpminWidth, bottom-center,12 stimeout) 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 orpm clear.
🛡️ Security & Analysis (AltShift-v0.4.apk)
- VirusTotal: Scan report
- Pithus: Static analysis
Full Changelog: v0.3.2...v0.4
v0.3.2
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 + Shifttoggles 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,
InputConnectioncalls, and device lookups are guarded so IME exceptions cannot take down system input.
🔄 Automatic IME Switching
- Physical keyboard detection & foreground monitor:
KeyboardPresenceMonitorchecksKEYBOARD_NOKEYS/hardKeyboardHiddenand enumeratesInputManagerdevices (excluding virtual and touchscreen-only devices;KEYBOARD_TYPE_ALPHABETICon API 29+).KeyboardSwitchServiceruns as an event-drivenspecialUseforeground service listening toInputDeviceListenercallbacks rather than polling. - Secure-settings switching & fallbacks: With
WRITE_SECURE_SETTINGS,InputMethodSwitcherupdatesSettings.Secure.DEFAULT_INPUT_METHODdirectly, 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/nextguarded to API 28+). - Soft-keyboard suppression & reboot recovery:
onShowInputRequested()returnsfalsewhile a physical keyboard is attached;BootReceiverrestartsKeyboardSwitchServiceafterBOOT_COMPLETEDwhen auto-switching is enabled andWRITE_SECURE_SETTINGSis 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, andRecyclerViewapp picker, with persisted Light/Dark/System themes (root overdraw removed). - Pure Java 21 & zero-bloat storage: Uses AppCompat, Material 3,
RecyclerView,SharedPreferences, andorg.jsononly—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).applicationVariantsnames outputsAltShift-v0.3.2.apkandAltShift-v0.3.2-debug.apk. GitHub Actions (actions/setup-java@v5, Temurin 21, Gradle cache) decodesKEYSTORE_BASE64intoapp/release.jks(always removed in cleanup), builds both variants, uploads artifacts, and publishes tags viasoftprops/action-gh-release. Added git-ignored local wrapper templatescripts/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, andThemeModeparsing/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.HardwareInputServiceOptional autonomous switching (also configurable via Settings → System → Languages & input → On-screen keyboard):
adb shell pm grant ru.b1sted.altshift android.permission.WRITE_SECURE_SETTINGSNote: 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)
- VirusTotal: Scan report
- Pithus: Static analysis
Full Changelog: v0.1...v0.3.2