KaiOS development on (non-rooted) Android

Skip to first unread message


Sep 30, 2020, 1:27:00 PM9/30/20
to comp.mobile.nokia.8110
Hi folks,

As I received my new Lenovo TB-X606X tablet, I faced a need to be able to connect to different KaiOS devices from it without any "normal" PC nearby (so I couldn't just connect a cable and run adb tcpip 5555 command). Luckily, I found a way to do this by using a known web context vulnerability in KaiOS that allows us to manipulate Android property set directly from the browser.

So, here's the guide.

1. Create a publicly available web page with a button that runs the following JS code on the click:

var masterExt = navigator.engmodeExtension || navigator.jrdExtension || navigator.kaiosExtension
var propSet = {
  'service.adb.tcp.port': 5555,
  'ctl.stop': 'adbd',
  'ctl.start': 'adbd'
for(var key in propSet) {
  masterExt.setPropertyValue(key, propSet[key])

Essentially, what it does is setting the Android property service.adb.tcp.port and restarting adbd via the predefined ctl.* property hooks. Yes, I know that these hooks aren't present in KitKat-based systems, so for those, manual ADB restart will be required.

2. Prepare the necessary parts on Android side:

- install Termux (I recommend installing it from F-Droid);
- within Termux, install a customized ADB binary (I recommend using these scripts - https://github.com/MasterDevX/Termux-ADB) and verify it launches correctly;
- within Termux, install nodejs (pkg install nodejs) and gdeploy:

git clone https://gitlab.com/suborg/gdeploy.git
cd gdeploy
npm i --global

3. Make sure your Android and KaiOS device are connected to the same Wi-Fi network at this point. Record the IP address of your KaiOS device by going to the access point's preferences.

4. On KaiOS side, enable the debugger (ADB & DevTools) in the developer menu, optionally also enable the root access (via Wallace Toolbox etc) if needed. Then, go to the page you've published via the system browser and launch the code.

5. On Android side, run adb connect [your_phone_ip]:5555 and then ensure you see the device in adb devices command.

6. Now you can manage the apps on the device with the gdeploy command (gdeploy list/install/uninstall/start/stop/evaluate) fully wirelessly. Use Vim or other convenient editor for the development process on your Android and Termux + gdeploy for actual device testing.

Notes and limitations:

- you'll need to re-enable the remote ADB port via web page exploit every time your reboot your KaiOS device;
- on KaiOS devices with Gonk layer based on Android version less than 6 (most MediaTek or Unisoc devices), you'll need to manually restart adbd via developer menu (Debugger - None and then Debugger - ADB & DevTools) after enabling the remote port;
- Android doesn't have a full-featured B2G-compatible WebIDE, as it's only usually viewed as a target, not as a development host. However, alternatives like gdeploy may usually be sufficient for most of our purposes.

Have fun and - most importantly - never give up!

G Power

Oct 1, 2020, 1:10:43 PM10/1/20
to comp.mobile.nokia.8110
Wow you are now come nearby to launch KaiOS android launcher ;)
Reply all
Reply to author
0 new messages