Skip to content

Commit 871ca63

Browse files
committed
better readme, tap to pay beta, seemless update
1 parent 68d813f commit 871ca63

File tree

3 files changed

+28
-61
lines changed

3 files changed

+28
-61
lines changed

README.md

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
# NFCScreenOff
22

3-
**This is not a systemless modification.**
4-
53
Read NFC tags when screen is off.
64

7-
_Useful integrations_
8-
[NFC Card Emulator Pro](https://play.google.com/store/apps/details?id=com.yuanwofei.cardemulator.pro)
9-
[Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm)
5+
[BETA] Tap to pay when screen is off.
106

11-
# Help section
7+
_Useful integrations: [NFC Card Emulator Pro](https://play.google.com/store/apps/details?id=com.yuanwofei.cardemulator.pro) - [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm)_
128

13-
**GOOGLE PAY DOES NOT WORK WHEN SCREEN IS OFF**
9+
# How does it work?
1410

15-
This is normal, you need to wake up the device to pay in stores.
11+
The NFC app is patched during installation into a `modded` version. This `modded` version is injected at boot time by [service.sh](service.sh) so that the phone thinks the screen is always on and unlocked. This patch only applies to NFC Service so it does not impact any other functionality of the phone that involves screen state detection.
1612

17-
**MY NFC IS NOT DETECTED ANYMORE**
13+
The `modded` app was generated using [this method](https://github.com/lapwat/NfcScreenOffPie).
1814

19-
If you did not unlock your device since last boot, unlock it and wait 30 seconds for the module to be loaded.
20-
21-
After that time, if NFC does not start automatically or manually, it means that the patch does not work. You can uninstall the module and create an issue.
15+
# Help section
2216

2317
**I AM STUCK IN A BOOTLOOP**
2418

@@ -36,47 +30,18 @@ Perform a clean reinstallation.
3630
1. Uninstall the module
3731
1. Reboot
3832
1. Install the module
39-
1. Restart your device
33+
1. Reboot
4034

4135
If it does not solve your problem, you can create an issue.
4236

43-
# How does it work?
44-
45-
I succeeded to make it work only if the `modded` APK is injected while the phone is booted with the `original` APK. That is why I inject the `modded` APK in [service.sh](service.sh).
37+
**TAP TO PAY DOES NOT WORK WHEN SCREEN IS OFF**
4638

47-
I have patched the original `NfcNci.apk` (com/android/nfc/NfcService.smali) so that the phone thinks the screen is always on and unlocked. This patch only applies to NFC Service so it does not impact any other functionality of the phone.
48-
49-
The modded APK was generated using the method described [here](https://github.com/lapwat/NfcScreenOffPie).
50-
51-
52-
I will do my best to make it compatible.
53-
54-
# Working devices
55-
56-
| Android Version | ROM | Device |
57-
|-----------------|-------------|----------------------|
58-
| 10 | crDroid 6.2 | Xiaomi Redmi K20 Pro |
59-
| 10 | Lineage 16 | Moto G5S Plus |
60-
| 9 | Havoc 2.8 | Xiaomi Redmi K20 Pro |
61-
62-
Leave a comment with your working device on the [XDA thread](https://forum.xda-developers.com/apps/magisk/module-nfcscreenoff8-t4034903).
63-
64-
# Useful
39+
This is normal, you need to wake up the device to pay in stores.
6540

66-
```sh
67-
# disassemble with baksmali
68-
java -jar baksmali-2.4.0.jar x -c arm64/boot.oat -d arm64/ NfcNci.odex -o NfcNci
41+
_Tap to pay functionality is now in BETA so it may work for some devices._
6942

70-
# mod
71-
sed 's/SCREEN_ON/SCREEN_ONA/' -i "NfcNci/com/android/nfc/NfcService.smali"
72-
sed 's/SCREEN_OFF/SCREEN_OFFA/' -i "NfcNci/com/android/nfc/NfcService.smali"
73-
sed 's/USER_PRESENT/USER_PRESENTA/' -i "NfcNci/com/android/nfc/NfcService.smali"
74-
sed 's/USER_SWITCHED/USER_SWITCHEDA/' -i "NfcNci/com/android/nfc/NfcService.smali"
43+
**MY NFC IS NOT DETECTED ANYMORE**
7544

76-
# assemble with smali
77-
java -jar smali-2.4.0.jar a -o classes.dex NfcNci/
45+
If you did not unlock your device since last boot, unlock it and wait 30 seconds for the module to be loaded.
7846

79-
# backup original
80-
cp NfcNci.apk NfcNci_mod.apk
81-
zip -rv NfcNci_mod.apk classes.dex
82-
```
47+
After that time, if NFC does not start automatically or manually, it means that the patch does not work for your device. You can uninstall the module and create an issue.

customize.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ my_grep_prop() {
88
sed -n "$REGEX" $FILES 2>/dev/null | head -n 1
99
}
1010

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-
1911
ui_print "-- Searching for NFC app in /system/app/ folder..."
2012

2113
set 'NfcNci' 'NQNfcNci' 'NxpNfcNci'
@@ -28,7 +20,14 @@ done
2820
[ -z $APK_NAME ] && abort "!! Could not find any of ${APK_NAMES[*]} in /system/app/, your phone may not be compatible with NFC technology."
2921
ui_print "-- $APK_NAME.apk found!"
3022

31-
# save device infos
23+
# gather device infos
24+
MANUFACTURER="$(my_grep_prop 'ro\.product\.manufacturer')"
25+
MODEL="$(my_grep_prop 'ro\.product\.model' )"
26+
DEVICE="$(my_grep_prop 'ro\.product\.device' )"
27+
ROM="$(my_grep_prop 'build\.version' )"
28+
[ -z "$MANUFACTURER" ] && MANUFACTURER="$(my_grep_prop 'ro\.product\.vendor\.manufacturer')"
29+
[ -z "$MODEL" ] && MODEL="$(my_grep_prop 'ro\.product\.vendor\.model' )"
30+
[ -z "$DEVICE" ] && DEVICE="$(my_grep_prop 'ro\.product\.vendor\.device' )"
3231
echo "MANUFACTURER=$MANUFACTURER" > "$MODPATH/.env"
3332
echo "MODEL=$MODEL" >> "$MODPATH/.env"
3433
echo "DEVICE=$DEVICE" >> "$MODPATH/.env"
@@ -45,6 +44,7 @@ REPLACE="
4544

4645
mkdir "$MODPATH/$APK_NAME"
4746

47+
# create backup
4848
ui_print "-- Searching for $APK_NAME.apk backup..."
4949
if [ -f "/data/adb/modules/NFCScreenOff/${APK_NAME}_bak.apk" ] ; then
5050
ui_print "-- ${APK_NAME}_bak.apk found! Copying backup to the module update folder."
@@ -54,14 +54,16 @@ else
5454
cp "$APK_PATH" "$MODPATH/${APK_NAME}_bak.apk"
5555
fi
5656

57+
# retrieve modded apk
5758
ui_print "-- Searching for custom $APK_NAME.apk in extracted files..."
5859
if [ -f "$MODPATH/${APK_NAME}_align.apk" ] ; then
5960
ui_print "-- ${APK_NAME}_align.apk found! Nothing to do."
6061
else
6162
# prepare files
6263
ui_print "-- ${APK_NAME}_align.apk not found."
6364
ui_print "-- Zipping $APK_NAME.apk and device's framework"
64-
zip -j "$TMPDIR/$APK_NAME.zip" "$MODPATH/.env" /system/framework/framework-res.apk "$APK_PATH"
65+
cp "$MODPATH/${APK_NAME}_bak.apk" "$TMPDIR/$APK_NAME.apk"
66+
zip -j "$TMPDIR/$APK_NAME.zip" "$MODPATH/.env" "$TMPDIR/$APK_NAME.apk" /system/framework/framework-res.apk
6567

6668
# download custom apk
6769
ui_print "-- Uploading device's apks for modding (~15Mb)"

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.2
4-
versionCode=12
3+
version=v0.2.0
4+
versionCode=20
55
author=lapwat
6-
description=Read NFC tags when screen is off
6+
description=Read NFC tags when screen is off. [BETA] Tap to pay when screen is off.

0 commit comments

Comments
 (0)