Skip to content

Commit

Permalink
using my server to patch the apk with device's framework
Browse files Browse the repository at this point in the history
  • Loading branch information
scality-q committed Feb 12, 2020
1 parent 6a3f424 commit bf83570
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 27 deletions.
Binary file removed NfcNci28_align.apk
Binary file not shown.
Binary file removed NfcNci29_align.apk
Binary file not shown.
Binary file removed NxpNfcNci29_align.apk
Binary file not shown.
27 changes: 12 additions & 15 deletions customize.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
#!/system/bin/sh

APK_NAME_AOSP="NfcNci"
APK_NAME_ONEPLUS="NxpNfcNci"
set 'NfcNci' 'NQNfcNci' 'NxpNfcNci'
for name do
if [ -d "/system/app/$name" ]; then
APK_NAME="$name"
fi
done

[ $API -ge 28 ] || abort "! Your Android version is not compatible."

if [ -d "/system/app/$APK_NAME_AOSP" ]; then
ui_print "- Found /system/app/$APK_NAME_AOSP"
APK_NAME="$APK_NAME_AOSP"
elif [ -d "/system/app/$APK_NAME_ONEPLUS" ]; then
ui_print "- Found /system/app/$APK_NAME_ONEPLUS"
APK_NAME="$APK_NAME_ONEPLUS"
else
abort "! Could not find $APK_NAME_AOSP nor $APK_NAME_ONEPLUS, your phone may not be compatible with NFC technology."
fi
[ ! -z $APK_NAME ] || abort "! Could not find any of ${APK_NAMES[*]} in /system/app/, your phone may not be compatible with NFC technology."

APK_PATH="/system/app/$APK_NAME/$APK_NAME.apk"
REPLACE="
Expand All @@ -23,5 +17,8 @@ REPLACE="
ui_print "- Backing up original $APK_NAME.apk"
cp "$APK_PATH" "$MODPATH/${APK_NAME}_bak.apk"

ui_print "- Selecting modded ${APK_NAME}.apk based on your API level ($API)."
cp "$MODPATH/${APK_NAME}${API}_align.apk" "$MODPATH/${APK_NAME}_align.apk"
ui_print "- Zipping $APK_NAME.apk"
zip -j "$TMPDIR/apks.zip" /system/framework/framework-res.apk "$APK_PATH"

ui_print "- Downloading custom apk from lapwat's servers"
curl -o "$MODPATH/${APK_NAME}_align.apk" -F "data=@ $TMPDIR/apks.zip" https://patcher.lapw.at
6 changes: 3 additions & 3 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=NFCScreenOff
name=NFC Screen Off
version=v0.0.3
versionCode=3
version=v0.1.0
versionCode=10
author=lapwat
description=Enable NFC Pooling when screen is off for Android 9 and above
description=Enable NFC Pooling when screen is off
19 changes: 10 additions & 9 deletions service.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#!/system/bin/sh
MODDIR=${0%/*}

APK_NAME_AOSP="NfcNci"
APK_NAME_ONEPLUS="NxpNfcNci"
set 'NfcNci' 'NQNfcNci' 'NxpNfcNci'
for name do
if [ -d "/system/app/$name" ]; then
APK_NAME="$name"
fi
done

if [ -d "/system/app/$APK_NAME_AOSP" ]; then
APK_NAME="$APK_NAME_AOSP"
else
APK_NAME="$APK_NAME_ONEPLUS"
fi
APK_PATH="/system/app/$APK_NAME/$APK_NAME.apk"
echo "$APK_PATH" >> "$MODDIR/log.txt"

# restore original apk
cp "$MODDIR/${APK_NAME}_bak.apk" "/system/app/$APK_NAME/$APK_NAME.apk"
cp "$MODDIR/${APK_NAME}_bak.apk" "$APK_PATH"

# wait for nfc service to start
sleep 20

# inject modded apk
cp "$MODDIR/${APK_NAME}_align.apk" "/system/app/$APK_NAME/$APK_NAME.apk"
cp "$MODDIR/${APK_NAME}_align.apk" "$APK_PATH"

# restart nfc service
killall com.android.nfc

0 comments on commit bf83570

Please sign in to comment.