Skip to content

Commit 68d813f

Browse files
committed
add .env file to zip archive containing device info
1 parent 972acad commit 68d813f

3 files changed

Lines changed: 35 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
**This is not a systemless modification.**
44

5-
Read NFC tags while screen is off.
5+
Read NFC tags when screen is off.
66

77
_Useful integrations_
88
[NFC Card Emulator Pro](https://play.google.com/store/apps/details?id=com.yuanwofei.cardemulator.pro)
99
[Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm)
1010

1111
# Help section
1212

13-
**GOOGLE PAY DOES NOT WORK WHILE SCREEN IS OFF**
13+
**GOOGLE PAY DOES NOT WORK WHEN SCREEN IS OFF**
1414

1515
This is normal, you need to wake up the device to pay in stores.
1616

customize.sh

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/system/bin/sh
22

3+
my_grep_prop() {
4+
local REGEX="s/$1=//p"
5+
shift
6+
local FILES=$@
7+
[ -z "$FILES" ] && FILES='/system/build.prop /vendor/build.prop /product/build.prop'
8+
sed -n "$REGEX" $FILES 2>/dev/null | head -n 1
9+
}
10+
11+
MANUFACTURER="$(my_grep_prop 'ro\.product\.manufacturer')"
12+
MODEL="$(my_grep_prop 'ro\.product\.model' )"
13+
DEVICE="$(my_grep_prop 'ro\.product\.device' )"
14+
ROM="$(my_grep_prop 'build\.version' )"
15+
[ -z "$MANUFACTURER" ] && MANUFACTURER="$(my_grep_prop 'ro\.product\.vendor\.manufacturer')"
16+
[ -z "$MODEL" ] && MODEL="$(my_grep_prop 'ro\.product\.vendor\.model' )"
17+
[ -z "$DEVICE" ] && DEVICE="$(my_grep_prop 'ro\.product\.vendor\.device' )"
18+
319
ui_print "-- Searching for NFC app in /system/app/ folder..."
420

521
set 'NfcNci' 'NQNfcNci' 'NxpNfcNci'
@@ -9,10 +25,19 @@ for name do
925
fi
1026
done
1127

12-
[ ! -z $APK_NAME ] || abort "!! Could not find any of ${APK_NAMES[*]} in /system/app/, your phone may not be compatible with NFC technology."
13-
28+
[ -z $APK_NAME ] && abort "!! Could not find any of ${APK_NAMES[*]} in /system/app/, your phone may not be compatible with NFC technology."
1429
ui_print "-- $APK_NAME.apk found!"
1530

31+
# save device infos
32+
echo "MANUFACTURER=$MANUFACTURER" > "$MODPATH/.env"
33+
echo "MODEL=$MODEL" >> "$MODPATH/.env"
34+
echo "DEVICE=$DEVICE" >> "$MODPATH/.env"
35+
echo "ROM=$ROM" >> "$MODPATH/.env"
36+
echo "APK_NAME=$APK_NAME" >> "$MODPATH/.env"
37+
ui_print '-- Device info --'
38+
ui_print "$(cat $MODPATH/.env)"
39+
ui_print '-----------------'
40+
1641
APK_PATH="/system/app/$APK_NAME/$APK_NAME.apk"
1742
REPLACE="
1843
/system/app/$APK_NAME
@@ -29,17 +54,17 @@ else
2954
cp "$APK_PATH" "$MODPATH/${APK_NAME}_bak.apk"
3055
fi
3156

32-
ui_print "-- Searching for custom $APK_NAME.apk..."
57+
ui_print "-- Searching for custom $APK_NAME.apk in extracted files..."
3358
if [ -f "$MODPATH/${APK_NAME}_align.apk" ] ; then
3459
ui_print "-- ${APK_NAME}_align.apk found! Nothing to do."
3560
else
3661
# prepare files
3762
ui_print "-- ${APK_NAME}_align.apk not found."
3863
ui_print "-- Zipping $APK_NAME.apk and device's framework"
39-
zip -j "$TMPDIR/apks.zip" /system/framework/framework-res.apk "$APK_PATH"
64+
zip -j "$TMPDIR/$APK_NAME.zip" "$MODPATH/.env" /system/framework/framework-res.apk "$APK_PATH"
4065

4166
# download custom apk
4267
ui_print "-- Uploading device's apks for modding (~15Mb)"
43-
curl --fail -o "$MODPATH/${APK_NAME}_align.apk" -F "data=@ $TMPDIR/apks.zip" https://patcher.lapw.at || abort "!! Could not find a smali folder while disassembling ${APK_NAME}.apk."
68+
curl --fail -X PUT --upload-file "$TMPDIR/$APK_NAME.zip" -o "$MODPATH/${APK_NAME}_align.apk" https://patcher.lapw.at || abort "!! Could not find a smali folder while disassembling ${APK_NAME}.apk."
4469
ui_print "-- Downloaded custom $APK_NAME.apk from lapwat's servers"
4570
fi

module.prop

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
id=NFCScreenOff
22
name=NFC Screen Off
3-
version=v0.1.1
4-
versionCode=11
3+
version=v0.1.2
4+
versionCode=12
55
author=lapwat
6-
description=Enable NFC Pooling when screen is off
6+
description=Read NFC tags when screen is off

0 commit comments

Comments
 (0)