Enable gesture (swipe) input (on Fairphone 2) without Google Keyboard


Question

I have Fairphone 2 running Fairphone Open OS, and I'm making a quixotic effort to avoid installing non-free (as in freedom) software on it and to optimize privacy.



I want swipe input, but I don't want to install Google Keyboard, (LatimeImeGoogle.apk) By default, the OS has AOSP keyboard. I've also installed the wonderfully code-friendly AnySoftKeyboard (which also has awesome themes) and Hacker's Keyboard from F-Droid, but though they are useful to me, they don't have swipe input.



I've read this post which makes me think I have to get the source and compile the keyboard. I don't know how to do this at the moment, but I'm prepared to learn. I tried just replacing the library (by cheating and taking the correct library from the Google apk) mentioned in the post, and nothing changed (if I delete the library the keyboard stops working completely, so clearly I am making a system change by replacing it - it just doesn't do what I want).



I would like any of the following, in order of preference




  1. a nice code-friendly FOSS keyboard with gesture input

  2. a simple* way to enable gesture input for AOSP

  3. confirmation that I do, in fact, need to build AOSP myself to do what I want

  4. any other relevant advice(!)



Obviously, I have root :)



*I have an Ubuntu system to play with on my laptop if it helps...


Answer

The problem



The default AOSP keyboard does not ship with swipe. It will not appear in the settings.
The easy (but awkward) reason is that Google considered this feature to be too "secret" or so to release it in the open source code and thus they ship it in a proprietary library.



The solution



If you want, you can push that library to your device after the ROM installation (and each update!). It is named libjni_latinimegoogle.so and needs to be put in /system/lib.



For me (Android 7.1, ARM) this lib was a really small (944 kB) and oldish (updated 2008) thing. (sha256sum: 442a2a8bfcb25489564bc9433a916fa4dc0dba9000fe6f6f03f5939b985091e6)



Detailed guide




  1. Download the correct Google Apps from http://opengapps.org/. (although I guess the lib may be the same for some versions, but well… just download the correct one)

  2. Now get into the ZIP, respectively extract it. In the Optional dir you'll find another archive swypelibs-lib-arm.tar.lz. Extract that and you'll get the libjni_latinimegoogle.so file.

  3. Now have your phone/device ready in recovery mode. Make sure to mount the /system partition in a writable way. In TWRP you have to go to "Mount" -> (if needed, uncheck) "mount /system in read-only" and then mount it by checking the box for "/system".

  4. Now just push to file to your phone (adb push /path/to/libjni_latinimegoogle.so /system/lib) and restart.



It should work!



OTA survival



I said you need to do this for each update. You can, however, also create a small OTA survival script, which backs up the file when the system is updated.



Here is my (currently, experimental) proposal:



#!/sbin/sh
#
# /system/addon.d/95-latinimegoogle.sh
# During an OS upgrade, this script backs up /system/lib/libjni_latinimegoogle.so,
# /system is formatted and reinstalled, then the file is restored.
#

. /tmp/backuptool.functions

list_files() {
cat <<EOF
lib/libjni_latinimegoogle.so
EOF
}

case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac


Also available on GitHub: https://gist.github.com/rugk/a4c9fa11c5c031faf45602d6bf922a1c




  1. Just save that file, push it your device into the /system/addon.d dir (adb push 95-latinimegoogle.sh /system/addon.d). (Yet again, you have to make sure /system is mounted.)

  2. And make it executable: adb shell into your device, go to the dir via cd /system/addon.d and: chmod +x 95-latinimegoogle.sh.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes