Skip to content

v0.4.2

Choose a tag to compare

@github-actions github-actions released this 12 Nov 17:52
· 43 commits to main since this release
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