|
1 | 1 | # NFCScreenOff |
2 | 2 |
|
3 | | -Enable NFC pooling while **phone is locked and screen is off** for Android 9 and above. |
| 3 | +**This is not a systemless modification.** |
4 | 4 |
|
5 | | -> If you restart your phone, wait 30 seconds after unlocking it to let NFC service time to reload. |
| 5 | +Read NFC tags while screen is off. |
6 | 6 |
|
7 | | -For now, it only works for reading NFC tags, not for payments in stores. |
| 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) |
8 | 10 |
|
9 | | -**This is not a systemless modification.** 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). |
| 11 | +# Help section |
10 | 12 |
|
11 | | -# How to test? |
| 13 | +**GOOGLE PAY DOES NOT WORK WHILE SCREEN IS OFF** |
12 | 14 |
|
13 | | -1. Download a card emulator like [this app](https://play.google.com/store/apps/details?id=com.yuanwofei.cardemulator.pro). |
14 | | -1. Put a NFC tag on the back of your phone while it is locked and the screen turned off. |
15 | | -1. Your phone should give you a feedback that it has successfully read the tag (sound, vibration). |
| 15 | +This is normal, you need to wake up the device to pay in stores. |
| 16 | + |
| 17 | +**MY NFC IS NOT DETECTED ANYMORE** |
| 18 | + |
| 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. |
| 22 | + |
| 23 | +**I AM STUCK IN A BOOTLOOP** |
| 24 | + |
| 25 | +Remove the module manually. |
| 26 | + |
| 27 | +1. Boot into TWRP |
| 28 | +1. Advanced -> File Manager |
| 29 | +1. Delete /adb/modules/NFCScreenOff |
| 30 | +1. Reboot |
| 31 | + |
| 32 | +**THE MODULE IS NOT WORKING SINCE LAST UPDATE** |
| 33 | + |
| 34 | +Perform a clean reinstallation. |
| 35 | + |
| 36 | +1. Uninstall the module |
| 37 | +1. Reboot |
| 38 | +1. Install the module |
| 39 | +1. Restart your device |
| 40 | + |
| 41 | +If it does not solve your problem, you can create an issue. |
| 42 | + |
| 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). |
| 46 | + |
| 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). |
16 | 50 |
|
17 | | -If it did not work, uninstall this module and you will be back and running. Please also leave a comment on this [XDA Thread](https://forum.xda-developers.com/apps/magisk/module-nfcscreenoff8-t4034903) with: |
18 | | -1. Your Android Version |
19 | | -1. The name of your ROM |
20 | | -1. The name of your device |
21 | | -1. Logs of Magisk (if the installation failed) |
22 | 51 |
|
23 | 52 | I will do my best to make it compatible. |
24 | 53 |
|
25 | | -# Tested devices |
| 54 | +# Working devices |
26 | 55 |
|
27 | 56 | | Android Version | ROM | Device | |
28 | 57 | |-----------------|-------------|----------------------| |
29 | 58 | | 10 | crDroid 6.2 | Xiaomi Redmi K20 Pro | |
30 | 59 | | 10 | Lineage 16 | Moto G5S Plus | |
31 | 60 | | 9 | Havoc 2.8 | Xiaomi Redmi K20 Pro | |
32 | 61 |
|
33 | | -# Under the hood |
| 62 | +Leave a comment with your working device on the [XDA thread](https://forum.xda-developers.com/apps/magisk/module-nfcscreenoff8-t4034903). |
34 | 63 |
|
35 | | -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. |
| 64 | +# Useful |
36 | 65 |
|
37 | | -The modded APK was generated using the method described [here](https://github.com/lapwat/NfcScreenOffPie). |
| 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 |
| 69 | + |
| 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" |
| 75 | + |
| 76 | +# assemble with smali |
| 77 | +java -jar smali-2.4.0.jar a -o classes.dex NfcNci/ |
38 | 78 |
|
39 | | -# Todo |
40 | | -- [ ] Make it work for host card emulator to pay in stores |
| 79 | +# backup original |
| 80 | +cp NfcNci.apk NfcNci_mod.apk |
| 81 | +zip -rv NfcNci_mod.apk classes.dex |
| 82 | +``` |
0 commit comments