Skip to content

Instantly share code, notes, and snippets.

@bricewge
Last active October 4, 2020 17:09
Show Gist options
  • Save bricewge/586e149df487da6e8ac2775c29ee4276 to your computer and use it in GitHub Desktop.
Save bricewge/586e149df487da6e8ac2775c29ee4276 to your computer and use it in GitHub Desktop.
Customizations for Android

Customizations for herolte

Disable hardware keys

If you have root enabled on your device just do the following to remount the /system as read and write.

adb root
adb remount

Otherwise you’ll have to reboot into recovery and mount the /system partition.

To disable hardware keys you need to comment lines about keycodes 139, 158 and 254 in files /system/usr/keylayout/{Generic,sec_touchkey}.kl.

adb shell <<EOF
for keylayout in /system/usr/keylayout/{Generic,sec_touchkey}.kl; do
    mv -n "\$keylayout" "\$keylayout".bak
    sed -E '/^key (139|158|254)/s/^/#/' "\$keylayout".bak > "\$keylayout"
done
EOF
test $? = 0  && adb reboot

Ressources

Enable keyboard swipe

Get the libjni library from an Open GApps package.

version=10.0
arch=arm64
opengapps_version=$(curl -s "https://api.github.com/repos/opengapps/$arch/releases/latest" | sed -n 's|.*/\([0-9]\{8\}\)/\\n.*|\1|p')
opengapps_file="open_gapps-$arch-$version-pico-$opengapps_version.zip"
opengapps_url="https://sourceforge.net/projects/opengapps/files/$arch/$opengapps_version/$opengapps_file/download"
curl --location "$opengapps_url" --output "$opengapps_file"
unzip -B -j $opengapps_file  Optional/swypelibs-lib-"$arch".tar.lz
tar xf swypelibs-lib-"$arch".tar.lz

And put the library on your phone, wich is assumed to be rooted.

adb root
adb remount
adb push swypelibs-lib-"$arch"/common/lib* /system/
test $? = 0  && adb reboot

Dependencies

  • curl
  • lzip
  • unzip

Ressources

Add support for NFC extended ADPU

It fixes OpenKeyChain issue with some Yubikey 5 NFC: “error transceive length exceeds supported maximum”.

config=ISO_DEP_MAX_TRANSCEIVE=0xFEFF
for file in /system_root/vendor/etc/libnfc-brcm.conf /system_root/vendor/etc/libnfc-nci.conf; do
  grep -q "$config" "$file" || echo "$config" >> "$file"
done

Ressources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment