An attempt to run fcitx5 on Android

Overview

fcitx5-android-poc

An attempt to run fcitx5 on Android.

Project status

It can build, run, and print to stdout.

Build

Dependencies

  • Android SDK Platform & Build-Tools 30
  • Android NDK (Side by side) 23 & cmake 3.18.1 . Note: you may need to install Android Studio Beta for Android NDK 23. NDK 21 & 22 are comfirmed not working with this project.
  • KDE/extra-cmake-modules

Patch CMakeLists.txt

If cmake complaint about "cannot find ...", just comment out those lines. Believe me, it will build. See my patchs here: https://gist.github.com/rocka/f25d29bc6ceb31033543fd95eba09bf9

libime data

I don't know why cmake won't download and generate those data. Just install libime, and copy /usr/{lib,share}/libime/* to app/src/main/assets/fcitx5/libime/.

fcitx5-chinese-addons dict

Make it read dict path from environment variable, we need to specify that path at runtime.

diff --git a/im/pinyin/pinyin.cpp b/im/pinyin/pinyin.cpp
index 2f98f7f..1cceb7e 100644
--- a/im/pinyin/pinyin.cpp
+++ b/im/pinyin/pinyin.cpp
@@ -607,7 +607,7 @@ PinyinEngine::PinyinEngine(Instance *instance)
             libime::DefaultLanguageModelResolver::instance()
                 .languageModelFileForLanguage("zh_CN")));
     ime_->dict()->load(libime::PinyinDictionary::SystemDict,
-                       LIBIME_INSTALL_PKGDATADIR "/sc.dict",
+                       stringutils::joinPath(getenv("LIBIME_INSTALL_PKGDATADIR"), "sc.dict").c_str(),
                        libime::PinyinDictFormat::Binary);
     prediction_.setUserLanguageModel(ime_->model());

PoC

Logcat
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.301125 instance.cpp
D/fcitx5: :
D/fcitx5: 1371]
D/fcitx5: Override Enabled Addons: {
D/fcitx5: unicode,
D/fcitx5: punctuation,
D/fcitx5: androidfrontend, pinyin
D/fcitx5: }
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.301305 instance.cpp:
D/fcitx5: 1372]
D/fcitx5: Override Disabled Addons: {all
D/fcitx5: }
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.339251
D/fcitx5: addonmanager.cpp:
D/fcitx5: 189]
D/fcitx5: Loaded addon unicode
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.339849 addonmanager.cpp
D/fcitx5: :189]
D/fcitx5: Loaded addon androidfrontend
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.342312 inputmethodmanager.cpp
D/fcitx5: :117
D/fcitx5: ] No valid input method group in configuration.
D/fcitx5: Building a default one
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.343421
D/fcitx5:  instance.cpp
D/fcitx5: :
D/fcitx5: 730]
D/fcitx5: Items in Default
D/fcitx5: : [
D/fcitx5: InputMethodGroupItem(
D/fcitx5: keyboard-us,layout=
D/fcitx5: )]
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.343485 instance.cpp
D/fcitx5: :735]
D/fcitx5: Generated groups: [
D/fcitx5: Default]
D/fcitx5: E
D/fcitx5: 2021-06-10 21:14:01.343650 instance.cpp
D/fcitx5: :1381]
D/fcitx5: Couldn't find keyboard-us
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.346341 addonmanager.cpp:189] Loaded addon punctuation
D/fcitx5: E
D/fcitx5: 2021-06-10 21:14:01.636885
D/fcitx5:
D/fcitx5: pinyin.cpp
D/fcitx5: :
D/fcitx5: 647
D/fcitx5: ]
D/fcitx5: Failed to load pinyin history:
D/fcitx5: io fail: unspecified iostream_category error
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.706428
D/fcitx5:
D/fcitx5: addonmanager.cpp
D/fcitx5: :
D/fcitx5: 189
D/fcitx5: ]
D/fcitx5: Loaded addon
D/fcitx5: pinyin
W/ocka.fcitx5test: type=1400 audit(0.0:26994): avc: denied { read } for name="uuid" dev="proc" ino=15533979 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
W/ocka.fcitx5test: type=1400 audit(0.0:26995): avc: denied { read } for name="uuid" dev="proc" ino=15533979 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.735381
D/fcitx5:
D/fcitx5: androidfrontend.cpp
D/fcitx5: :
D/fcitx5: 71
D/fcitx5: ]
D/fcitx5: KeyEvent key:
D/fcitx5: n
D/fcitx5:  isRelease:
D/fcitx5: 0
D/fcitx5:  accepted:
D/fcitx5: 1
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.742409
D/fcitx5:
D/fcitx5: androidfrontend.cpp
D/fcitx5: :
D/fcitx5: 71
D/fcitx5: ]
D/fcitx5: KeyEvent key:
D/fcitx5: i
D/fcitx5:  isRelease:
D/fcitx5: 0
D/fcitx5:  accepted:
D/fcitx5: 1
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.771056
D/fcitx5:
D/fcitx5: androidfrontend.cpp
D/fcitx5: :
D/fcitx5: 71
D/fcitx5: ]
D/fcitx5: KeyEvent key:
D/fcitx5: h
D/fcitx5:  isRelease:
D/fcitx5: 0
D/fcitx5:  accepted:
D/fcitx5: 1
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.776967
D/fcitx5:
D/fcitx5: androidfrontend.cpp
D/fcitx5: :
D/fcitx5: 71
D/fcitx5: ]
D/fcitx5: KeyEvent key:
D/fcitx5: a
D/fcitx5:  isRelease:
D/fcitx5: 0
D/fcitx5:  accepted:
D/fcitx5: 1
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.790069
D/fcitx5:
D/fcitx5: androidfrontend.cpp
D/fcitx5: :
D/fcitx5: 71
D/fcitx5: ]
D/fcitx5: KeyEvent key:
D/fcitx5: o
D/fcitx5:  isRelease:
D/fcitx5: 0
D/fcitx5:  accepted:
D/fcitx5: 1
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.790626
D/fcitx5:
D/fcitx5: androidfrontend.cpp
D/fcitx5: :
D/fcitx5: 29
D/fcitx5: ]
D/fcitx5: Commit:
D/fcitx5: 你好
D/fcitx5: I
D/fcitx5: 2021-06-10 21:14:01.791372
D/fcitx5:
D/fcitx5: androidfrontend.cpp
D/fcitx5: :
D/fcitx5: 71
D/fcitx5: ]
D/fcitx5: KeyEvent key:
D/fcitx5: 1
D/fcitx5:  isRelease:
D/fcitx5: 0
D/fcitx5:  accepted:
D/fcitx5: 1
Comments
  • Help wanted to build on Windows!

    Help wanted to build on Windows!

    Hi,

    I need some help from devs how to configure and build this keyboard app on Android Studio i have done all required step but the app can't build on android studio on the first step it doesn't sync with gradle i got this error!

    cancelled
    :prepareKotlinBuildScriptModel
    settings.gradle.kts
    Build configuration failed, run 'gradle tasks' for more information
    build.gradle.kts
    org.gradle.internal.exceptions.LocationAwareException: Build file 'C:\Users\GoRaN\Desktop\KBoard\build.gradle.kts' line: 22
    Build configuration failed, run 'gradle tasks' for more information
    This script caused build configuration to fail, run 'gradle tasks' for more information
    java.lang.IllegalArgumentException: [email protected]09f59d2 must be locked before it can be used to compute a classpath!
    java.lang.IllegalArgumentException: project.classLoaderScope must be locked before querying the project schema
    build.gradle.kts
    org.gradle.internal.exceptions.LocationAwareException: Build file 'C:\Users\GoRaN\Desktop\KBoard\app\build.gradle.kts' line: 22
    Build configuration failed, run 'gradle tasks' for more information
    This script caused build configuration to fail, run 'gradle tasks' for more information
    java.lang.IllegalArgumentException: [email protected]09f59d2 must be locked before it can be used to compute a classpath!
    java.lang.IllegalArgumentException: project.classLoaderScope must be locked before querying the project schema
    java.lang.IllegalArgumentException: [email protected]2fbcca8 must be locked before it can be used to compute a classpath!
    java.lang.IllegalArgumentException: project.classLoaderScope must be locked before querying the project schema
    
    question build 
    opened by GoRaN909 8
  • Adding support for fcitx5-unikey

    Adding support for fcitx5-unikey

    Hi, I just come across this new project and I am very interested to see the fcitx5 input method ported to Android. So far I tried the English keyboard and it's a pretty decent keyboard (it's lacking the characters change to normal/CAPS when I press the switch). However since I am a Vietnamese I wonder if the team have any plan to port fcitx5-unikey to the app ?

    opened by hmtheboy154 4
  • Cleanup cmake build scripts

    Cleanup cmake build scripts

    We should avoid modifying submodules if possible — that is to say we have to make sure find_package work in submodules.

    1. For third-party libraries, we could use prebuilt static binaries. In this case, we could obtain configuration files (XXXConfig.cmake) from the build result, so find_package should work.
      • [ ] ~~curl with openssl~~
      • [x] boost
      • [x] libevent
      • [x] libintl-lite
      • [x] fmt
    2. For fcitx related libraries (fcitx5 and fcitx5-chinese-addons), the difference between third-party libraries is that these two libraries are interdependent, so it's not clear yet how to accomplish that. One possible way could be dropping their cmake files, delegating them to our top-level cmake file. However, this would require us to duplicate existing works, which might be tedious. The alternative could be using prebuilt version, but compiling them independently might be a non-trivial work.
    opened by berberman 4
  • Roadmap

    Roadmap

    Outdated, see more on our Trello: https://trello.com/b/gftk6ZdV/kanban

    Original, outdated Roadmap

    Short Term

    • [x] chinese-addons user dictionary manager UI
    • [ ] chinese-addons custom 双拼 profile editor ( https://github.com/fcitx/libime/blob/1.0.11/test/testshuangpinprofile.cpp )
    • [x] map Android EditorInfo (and InputType) to fcitx5 CapabilityFlag #23
    • [ ] share input state per program (maybe create an input context for each application)
    • [ ] surrounding text support in androidkeyboard (Android: InputConnection#getSurroundingText; fcitx5: fcitx::SurroundingText)
    • [x] invokeAction support in androidkeyboard (reference: PinyinEngine::invokeActionImpl) https://github.com/rocka/fcitx5-android-poc/commit/e2ffe7e950262ac692ecc5730e01f4e055809cdc
    • [ ] new fcitx API to now whether next "Return" KeyEvent would be captrued

    Mid Term

    Long Term

    • [ ] fully customizable keyboard layout
    • [ ] fcitx5-mozc

    Nice to have

    • [ ] Support Direct Boot mode (https://developer.android.com/training/articles/direct-boot)
    discussion 
    opened by berberman 4
  • [bug] QQ 聊天无法删除回复

    [bug] QQ 聊天无法删除回复

    描述

    一旦在QQ聊天中选择回复某一段文字,被选择的文字无法删除(可以选择回复另一段文字,但是不能不回复) 就图里面的那段文字无法删除,可以替换成回复别的消息。

    补充

    注: gboard 正常, 0.0.2-197-g4af305f-release 版本正常

    0.0.2-204-g5a4e391-release 不正常 0.0.2-210-g0eb401b-release 不正常

    附图

    security_Screenshot_20220914-112828-469

    bug component: IME service 
    opened by sukanka 3
  • 每次开机后会崩溃一次

    每次开机后会崩溃一次

    --------- Build Info Build Time: 2022-05-13T17:07:57Z Build Git Hash: b2a5f3b Build Version Name: 0.0.2-2-gb2a5f3b-release --------- Device Info App Package Name: org.fcitx.fcitx5.android App Version Name: 0.0.2-2-gb2a5f3b App Version Code: 2 OS Name: RQ3A.211001.001 OS Version: 4.19.217-Arrow-g60e77b7089e0 (12510) OS API Level: 30 Device: apollo Model (product): M2007J3SC (arrow_apollo) Manufacturer: Xiaomi Tags: release-keys Screen Size: 1080 x 2310 Screen Density: 2.75 Screen orientation: Portrait --------- beginning of main W/InputConnectionWrapper( 4481): requestUpdateCursorAnchorInfo() didn't respond in 2000 msec. Returning default: 0 E/CustomActivityOnCrash( 4481): App has crashed, executing CustomActivityOnCrash's UncaughtExceptionHandler E/CustomActivityOnCrash( 4481): java.lang.RuntimeException: Alive checking failed! The job didn't get run after 8000 ms! E/CustomActivityOnCrash( 4481): at org.fcitx.fcitx5.android.core.FcitxDispatcher$AliveChecker$install$1.invokeSuspend(FcitxDispatcher.kt:73) E/CustomActivityOnCrash( 4481): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) E/CustomActivityOnCrash( 4481): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) E/CustomActivityOnCrash( 4481): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/CustomActivityOnCrash( 4481): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/CustomActivityOnCrash( 4481): at java.lang.Thread.run(Thread.java:923) I/Process ( 4481): Sending signal. PID: 4481 SIG: 9

    倒是不影响什么 而且只有开机时会这样

    opened by lisansas 3
  • 修复连击语言切换按键,导致键盘符号显示错误的问题

    修复连击语言切换按键,导致键盘符号显示错误的问题

    连击语言切换按键,会导致键盘符号显示错误,视频如下:

    https://user-images.githubusercontent.com/17962023/201025732-8c4dd1d3-5d9a-4a4f-8df6-078d7cb6a5c8.mp4

    解决方案通过添加信号量保证updateMapping按顺序执行

    opened by ri-char 2
  • will cause

    will cause "Keyboard cursor control" in lineage unable to use / 会导致 lineage 的音量键控制光标无法使用

    in lineage os, there is a feature called "Keyboard cursor control". can use Volume up/down keys to move cursor left/right. but after using this ime. that feature not working anymore. 这个输入法好像会导致 lineage 的“音量键当左右键用”的功能用不了

    opened by rhjdvsgsgks 2
  • symbol keyboard & themes from google pinyin ime / 使用来自谷歌拼音输入法的符号键盘与主题

    symbol keyboard & themes from google pinyin ime / 使用来自谷歌拼音输入法的符号键盘与主题

    google pinyin ime have a wider symbol keyboard. which provided much more symbol than usual gboard. it would be great if possible to used this symbol keyboard replace gboard one. 谷歌拼音有个挺大的符号键盘,提供了比 gboard 多很多的的符号,希望能用这个换掉目前的符号键盘 pic 谷歌拼音还有个几个 gboard 没有的配色,希望能一并加进来

    enhancement component: keyboard 
    opened by rhjdvsgsgks 2
  • F-Droid inclusion

    F-Droid inclusion

    Hello,

    Since this is an open-source app, would you approve to have it included to F-Droid? It's a strong community (actually almost the unique) focusing on distributing open-source Android apps, and you can find some other CJK IMEs like Trime, Guileless, Mozc, etc. already listed there.

    You can find documentation here.

    If you're interested, feel free to contact @ linsui (who speaks Chinese) or @ Poussinou for further details.

    Thanks for your attention and it wouldn't take too much time since their team would help you.

    PS: Apps on F-Droid are signed by F-Droid by default, but you can ask for the case of reproducible build, then they just verify if your builds are reproducible and simply distribute the builds signed by you, in that way there would be no problem of distributing packages with different signatures.

    PPS: just a suggestion, no matter if you agree to add the app to F-Droid, please regularly tag your releases so that others can easily know if there is any new version. Many thanks

    question discussion 
    opened by momobobe 2
  • Enlarge tapping areas for A and L keys

    Enlarge tapping areas for A and L keys

    In QWERTY layout, there are gaps to the left of A key and to the right of L key. In Gboard and Trime, these gaps are valid tapping areas as well. It would decrease tapping error if Fcitx5 for Android allows tapping in these gaps.

    enhancement component: keyboard 
    opened by wzyboy 1
Releases(0.0.3)
Owner
TypoError: Cannot read property 'null' of undefined
null
My humble attempt at getting tensorflow and the ESP32-CAM to cooperate

ESP32-Object-Recognition My humble attempt at getting tensorflow and the ESP32-CAM to cooperate (among other things) Notes: "Webcam_detection.py" isn'

null 13 Jun 21, 2022
My attempt at comparing the 5455 XDK kernel against an older build, NOT COMPILABLE CODE (Mainly psudocode with sections filled in)

xboxkrnl.exe build 5445 XDK CHK My attempt at comparing the 5455 XDK kernel an older build, NOT COMPILABLE CODE (Mainly psudocode with sections filled

null 2 Dec 4, 2021
Historical Bell Labs ratfor code. Plus an attempt to modernize it.

RATFOR --- Rational Fortran This repository tracks the history of the original C version of the Bell Labs ratfor translator written by Brian Kernighan

Arnold Robbins 9 May 5, 2022
My attempt at writing an Operating System from scratch

Operating System Trying to write my own operating system from scratch Current Status: Compiles ✔️ Directory Structure (Will be updated as changes happ

Nofil Qasim 12 Oct 6, 2022
CAAR is an attempt at writing a modern Lisp machine.

CAAR - The modern lisp machine CAAR is an attempt at writing a modern Lisp machine. The goal of this project is to be able to run a somewhat functiona

Abbix 10 Jun 19, 2022
Unity project with an example on how to run the depthai library in Android.

depthai-android-unity-example Unity project (built with Unity 2020.3.25f1) with an example on how to run the depthai library in Android. Important Thi

Ibai Gorordo 19 Dec 20, 2022
A customized LGL Android mod menu, containing ESP only for PUBG Mobile 1.3.0 for Android

PUBG Mobile ESP Mod Menu A customized LGL mod menu, containing ESP only for PUBG Mobile 1.3.0 for Android. Everything are fixed so it works with both

null 42 Mar 19, 2022
First open source android modding library for Geometry Dash Based on Hooking-and-Patching-android-template

Android-ML First open source android modding library for Geometry Dash Based on Hooking-and-Patching-android-template Installation Download this githu

BlackTea ML 21 Jul 17, 2022
A simple library that helps Android developers to execute JavaScript code from Android native side easily without using Webview.

AndroidJSModule A simple library that helps Android developers to execute JavaScript code from Android native side easily without using Webview. Insta

Hung Nguyen 5 May 24, 2022
A repository for experimenting with elf loading and in-place patching of android native libraries on non-android operating systems.

droidports: A repository for experimenting with elf loading and in-place patching of android native libraries on non-android operating systems. Discla

João Henrique 26 Dec 15, 2022
Android NDK samples with Android Studio

NDK Samples This repository contains Android NDK samples with Android Studio C++ integration. These samples use the new CMake Android plugin with C++

Android 9.2k Dec 27, 2022
Combining Sealighter with unpatched exploits to run the Threat-Intelligence ETW Provider

Sealighter-TI Combining Sealighter with unpatched exploits and PPLDump to run the Microsoft-Windows-Threat-Intelligence ETW Provider without a signed

pat_h/to/file 58 Dec 26, 2022
Run-time program generator embedded in C++

Run-time program generator embedded in C++

Z Guan 25 Aug 5, 2022
anthemtotheego 402 Dec 26, 2022
Run Linux programs on DOS

A WSL alternative for users who prefer an MS-DOS environment. DOS Subsystem for Linux integrates a real Linux environment into MS-DOS systems, allowing users to make use of both DOS and Linux applications from the DOS command prompt.

Hailey Somerville 1.3k Dec 22, 2022
Project #1: Run-length Encoding (Computer Architecture, Fall 2021)

4190.308 Computer Architecture (Fall 2021) Project #1: Run-length Encoding Due: 11:59PM, September 26 (Sunday) Introduction In this project, you need

SNU Systems Software & Architecture Laboratory 8 Dec 13, 2022
Realtime Micro Kernel -- Event-driven Run-to-Completion RTOS with Active Objects, Timed Events, Memory Pools, and Message Queues

Realtime Micro Kernel Features Active Objects Message queues Variable sized, custom messages Periodic and single timed events Memory pools Supported P

null 3 Nov 7, 2022
Phan Sang 17 Dec 29, 2022
A python library to run metal compute kernels on MacOS

metalcompute for Python A python library to run metal compute kernels on MacOS Usage Example execution from M1-based Mac running MacOS 12.0: > ./build

Andrew Baldwin 21 Nov 7, 2022