Android USB Tethering Bug & Fix

Posted by design0er on September 27, 2018
More Code, More Bug.

Android USB Tethering BUG & Fix


Just wanna to use sshd in Termux to remote control my android device using PC of win7 by ssh client.

What I have done:

  • install Termux
  • install libssh-tools
  • adb push to /sdcard/Download
  • cat >> $Home/.ssh/authorized_keys
  • check authorized_keys, have new inserted content
  • termux sshd
  • I don't want connect the public Wifi, so i just thought that a so-called usb-tethering option may works
  • 1st method:select android usb configuration, select RNDIS (USB Ethernet)
  • check the win7 OS, the new driver is auto installed, it's OK, nothing wrong.
  • check the IP of android and win7, the win7's IP is 169.x.x.x , the android status info show 172.x.x.x, just fucked. I quit.
  • 2nd method: turn on my PC's hotspot, android connect to win7.
  • oh.... wifi don't work, turn it on ,no ssid shown on the list, then it off automatically.nothing works.
  • with the slowly system, i decide to turn the xposed module off.and do adb reboot
  • holly shit, android system up BUT the system animation shows. It means: the developer options reset(or don't work), because i have close all 3 option of system animation(set the value to 0).
    • And... the notification bar cannot expand.
    • And... the developer options in system setting, show nothing, and a toast: the developer option is not avaliable for current user.
    • And... in system setting, click User, nothing happend.
    • It really appears that i just login into system as a guest user or new user.

Locate The Error

  • What Matters:
    • when i search the topic about RNDIS, many said the specification is not well implement and full with bug.
    • the usb setting may be innocent,and may be ignored mostly
    • Android developer options not available for current user
    • notification bar cannot drop down
    • adb reboot don't work ,it show the same after times of reboot
  • What don't matter:
    • nothing to do with xposed module, no matter the module is on or off
    • the latest toggle of xposed cause nothing
    • nothing todo with LineageOS 14.1 unoffical
    • adb reboot recovery clear cache don't work

How to solve

  • google search with android user group, useless work

  • google search with developer option not available,oh that's a common question

  • 2 method

    • adb shell am start -a android.intent.action.MAIN -n*
    • or use Nova launcher(or other app support activity shortcut), add widget, select Setup Wizard, select .SetupWizardTestActivity
  • BUT, LineageOS don't support .SetupWizardTestActivity, and .WelcomeActiviti don't work

  • SO, a deep method is needed:

  • windows cmd

    adb shell su
    rem in shell
    pm enable
    rem below just set the value to active the wizard activity
    adb shell settings put secure user_setup_complete 0
    rem note that the activity name may vary for devices
    adb shell am start -a android.intent.action.MAIN -n
    adb reboot
  • Here , after reboot ,the google setup screen shows, when you tap let's go,it should dive into setup page, just like new phone boot up.

  • But in LineageOS ,there are 2 option to select :google built in setup & LineageOS setup.

  • What's worse, both two wizard crash...

  • BUT that's OK,FUCK ME

adb shell settings put secure user_setup_complete 1
adb reboot
  • the android system boot up ,and all things get back.