What to do if you got Android with a broken touch screen

Published on January 27, 2014

What to do if you got Android with a broken touch screen

    image

    One day, the Nexus 4 fell into my hands. It's a rarity in our area, so I would like to use it as a main phone. Unfortunately, the touchscreen is broken. One of the sores of all modern smartphones. Well, it was decided to restore. I bought a touch on ebay. Now wait a month or two for Russia. I wanted to learn more about the device, to work with it while the package was traveling. At the same time, check whether everything works. And then, maybe the camera or speakers also crumbled. In this article, we consider the capture of device control if the touch is broken.


    Intelligence

    image
    During the test, nexus 4, usb cable, ubuntu as the axis for work, information from the Internet and brains will be used.

    The first thing I want to note is that the phone is completely in stock condition. The previous owner made a complete reset of all data. After switching on, the Welcome screen appears with a choice of language. Device control cannot be carried out without further intervention.

    Let me remind you that nexus 4 does not have OTG, so you cannot connect a mouse to it without a special cable with external power. I don’t have one, you can order on the same ebay, but wait again.

    Figachim

    The first thing I did was install CWM.
    Install programs for working with androids:

    sudo apt-get install android-tools-adb
    


    This is both fastboot and adb.

    You can set recovery through fastboot:

    fastboot flash recovery recovery.img
    

    Naturally, the notouch version is selected. By the way, I also unlocked the bootloader (fastboot oem unlock command). Changed the firmware to the latest immediately. I don’t remember why. For other phones, you need to look for your instructions. Some devices can be delivered through the built-in recovery, some have special programs for firmware.

    Boot into CWM. We look for the mounts and storage item and mount the system (or then do it through adb - mount -o remount, rw / system ). Useful.
    In the console on the computer we write

    adb devices


    It gives digits and recovery. That is what you need!

    Fine. Our tasks include: skip the welcome screen and enable usb debugging.
    To do this, download build.prop in the current folder

    adb pull /system/build.prop ./
    

    Open the downloaded file and replace the line:

    ro.setupwizard.enterprise_mode=1
    

    on

    ro.setupwizard.enterprise_mode=0
    ro.setupwizard.mode=DISABLED
    persist.service.adb.enable=1                                                    
    persist.service.debuggable=1
    persist.sys.usb.config=mtp,adb
    


    If you consider it necessary, you can correct some other lines. I kind of turned off the lock screen for convenience, but now it's too lazy to look for which line is responding. If not difficult, check out in the comments.

    Save and load back.

    adb push ./build.prop /system/
    

    Let us write the last lines in default.prop as well . Just in case.

    adb shell
    echo "persist.service.adb.enable=1" >> default.prop 
    echo "persist.service.debuggable=1" >> default.prop
    echo "persist.sys.usb.config=mtp,adb" >> default.prop
    

    Let's try to reboot. The

    image
    screen is reset .
    However adb devices shows offline.

    Kill adb team

    adb kill-server


    We make a request adb devices

    Still offline. Seems to have sailed. But no! The point is the keys.

    We are looking for a home folder dirrektorii /.android

    There was generated files adbkey.pub . It needs to be thrown on the device.

    We reboot in recovery, mount data, execute

    cd ~/.android
    adb push ./adbkey.pub /data/misc/adb/adb_keys
    

    Reboot again. We look adb devices - everything is there!

    Further, for example, I prescribed the buttons on the nampad of the adb shell input keyevent XX command
    image
    Code List
    0 --> «KEYCODE_UNKNOWN»
    1 --> «KEYCODE_MENU»
    2 --> «KEYCODE_SOFT_RIGHT»
    3 --> «KEYCODE_HOME»
    4 --> «KEYCODE_BACK»
    5 --> «KEYCODE_CALL»
    6 --> «KEYCODE_ENDCALL»
    7 --> «KEYCODE_0»
    8 --> «KEYCODE_1»
    9 --> «KEYCODE_2»
    10 --> «KEYCODE_3»
    11 --> «KEYCODE_4»
    12 --> «KEYCODE_5»
    13 --> «KEYCODE_6»
    14 --> «KEYCODE_7»
    15 --> «KEYCODE_8»
    16 --> «KEYCODE_9»
    17 --> «KEYCODE_STAR»
    18 --> «KEYCODE_POUND»
    19 --> «KEYCODE_DPAD_UP»
    20 --> «KEYCODE_DPAD_DOWN»
    21 --> «KEYCODE_DPAD_LEFT»
    22 --> «KEYCODE_DPAD_RIGHT»
    23 --> «KEYCODE_DPAD_CENTER»
    24 --> «KEYCODE_VOLUME_UP»
    25 --> «KEYCODE_VOLUME_DOWN»
    26 --> «KEYCODE_POWER»
    27 --> «KEYCODE_CAMERA»
    28 --> «KEYCODE_CLEAR»
    29 --> «KEYCODE_A»
    30 --> «KEYCODE_B»
    31 --> «KEYCODE_C»
    32 --> «KEYCODE_D»
    33 --> «KEYCODE_E»
    34 --> «KEYCODE_F»
    35 --> «KEYCODE_G»
    36 --> «KEYCODE_H»
    37 --> «KEYCODE_I»
    38 --> «KEYCODE_J»
    39 --> «KEYCODE_K»
    40 --> «KEYCODE_L»
    41 --> «KEYCODE_M»
    42 --> «KEYCODE_N»
    43 --> «KEYCODE_O»
    44 --> «KEYCODE_P»
    45 --> «KEYCODE_Q»
    46 --> «KEYCODE_R»
    47 --> «KEYCODE_S»
    48 --> «KEYCODE_T»
    49 --> «KEYCODE_U»
    50 --> «KEYCODE_V»
    51 --> «KEYCODE_W»
    52 --> «KEYCODE_X»
    53 --> «KEYCODE_Y»
    54 --> «KEYCODE_Z»
    55 --> «KEYCODE_COMMA»
    56 --> «KEYCODE_PERIOD»
    57 --> «KEYCODE_ALT_LEFT»
    58 --> «KEYCODE_ALT_RIGHT»
    59 --> «KEYCODE_SHIFT_LEFT»
    60 --> «KEYCODE_SHIFT_RIGHT»
    61 --> «KEYCODE_TAB»
    62 --> «KEYCODE_SPACE»
    63 --> «KEYCODE_SYM»
    64 --> «KEYCODE_EXPLORER»
    65 --> «KEYCODE_ENVELOPE»
    66 --> «KEYCODE_ENTER»
    67 --> «KEYCODE_DEL»
    68 --> «KEYCODE_GRAVE»
    69 --> «KEYCODE_MINUS»
    70 --> «KEYCODE_EQUALS»
    71 --> «KEYCODE_LEFT_BRACKET»
    72 --> «KEYCODE_RIGHT_BRACKET»
    73 --> «KEYCODE_BACKSLASH»
    74 --> «KEYCODE_SEMICOLON»
    75 --> «KEYCODE_APOSTROPHE»
    76 --> «KEYCODE_SLASH»
    77 --> «KEYCODE_AT»
    78 --> «KEYCODE_NUM»
    79 --> «KEYCODE_HEADSETHOOK»
    80 --> «KEYCODE_FOCUS»
    81 --> «KEYCODE_PLUS»
    82 --> «KEYCODE_MENU»
    83 --> «KEYCODE_NOTIFICATION»
    84 --> «KEYCODE_SEARCH»
    85 --> «TAG_LAST_KEYCODE»


    Although you can just put a VNC server (you need a root).

    I put through adb

    adb install vncfwq_1386321119498.apk 
    adb shell am start -n com.schumi.vncs/com.schumi.vncs.VNC_serverActivity
    

    From the numpad I set the settings, it turned out to turn on by typing the off command - adb shell input tap 400 300 (these are the typing coordinates)

    Well, so as not to get into the wifi settings
    adb forward tcp:5901 tcp:5901
    

    We start the vnc client, enter localhost: 5901 and do whatever our heart desires.
    image

    That's all. Lasting glass to you, dear!

    PS: I think everything can also be done with a broken display. You only need to take screenshots. It seems like a manual .