phhusson / treble_experimentations

Notes about tinkering with Android Project Treble
3.35k stars 659 forks source link

Issue with the Fingerprint Scanner on OUKITEL K7pro #2425

Open dev-2-4-h opened 2 years ago

dev-2-4-h commented 2 years ago

First, my thanks and gratitude for the work invested to build the phhusson line of ROMs.

I could find plenty of reports for "Fingerprint not working" none of those was like my issue. Therefore, I decided to file a new bug-report. Over the last week, I have tested nearly all available ROMs (Android 11 & 12) that are based on phhusson work and all of them have the same issue. For this reason, I believe it is something specific to the hardware and hope that someone from the community has an idea how to fix this.

Current Behaviour & Describe the bug & How To Reproduce

Test A) After flashing 'system-squeak-arm64-ab-vanilla.img' and rebooting, all looks normal. Going to the Security settings to set up PIN and Fingerprint also works as expected. Once that flow is completed, I can lock the screen and unlock with the Fingerprint sensor - as it should be. Then, when I reboot the device and the fingerprint sensor stopped working. I'm even not able to remove the saved fingerprint.

Test B) After flashing 'system-squeak-arm64-ab-gapps.img' and rebooting, the Google setup flow starts. Going through the stage up to the point to set up the screen lock, where I select PIN & Fingerprint. Next I set & confirm the PIN and then enter a loop, returning to the Google T&C page. The setup cannot be completed at all.

Test C) Flashing 'system-squeak-arm64-ab-gogapps.img' - the result is like test B Test D) Flashing 'system-squeak-arm64-ab-floss.img' - the result is like test A

Smartphone:

phhusson commented 2 years ago

Yes it's like other bugs, but that's okay. Don't set a PIN in Google wizard, then once completed, go in settings => applications, and disable "Android Setup" application (you can find more info in some other tickets mentioning that issue)

dev-2-4-h commented 2 years ago

Thanks for your replay - I tried this using system-squeak-arm64-ab-gapps.img.xz because it was mentioned in several of your replies. However, it doesn't resolve the issue.

Using system-squeak-arm64-ab-floss.img.xz - that has no "Android Setup" - the issue is the same. Fingerprint works until I reboot.

with adb logcat -d > logcat.txt I got this:

08-31 16:19:53.458 1317 1713 D Fingerprint21: Daemon was null, reconnecting, current operation: null 08-31 16:19:53.461 1317 1713 W Fingerprint21: NoSuchElementException 08-31 16:19:53.461 1317 1713 W Fingerprint21: java.util.NoSuchElementException 08-31 16:19:53.461 1317 1713 W Fingerprint21: at android.os.HwBinder.getService(Native Method) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at android.os.HwBinder.getService(HwBinder.java:81) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint.getService(IBiometricsFingerprint.java:74) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint.getService(IBiometricsFingerprint.java:84) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at com.android.server.biometrics.sensors.fingerprint.hidl.Fingerprint21.getDaemon(Fingerprint21.java:414) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at com.android.server.biometrics.sensors.fingerprint.hidl.Fingerprint21.isHardwareDetected(Fingerprint21.java:727) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at com.android.server.biometrics.sensors.fingerprint.FingerprintService$FingerprintServiceWrapper.isHardwareDetectedDeprecated(FingerprintService.java:662) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at android.hardware.fingerprint.IFingerprintService$Stub.onTransact(IFingerprintService.java:676) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at android.os.Binder.execTransactInternal(Binder.java:1184) 08-31 16:19:53.461 1317 1713 W Fingerprint21: at android.os.Binder.execTransact(Binder.java:1143) 08-31 16:19:53.461 1317 1713 W Fingerprint21: Fingerprint HAL not available

Does this help?

dev-2-4-h commented 2 years ago

@phhusson that is it - just saying it is the usual problem when it is clear that it is not. Thanks for your precious time.

phhusson commented 2 years ago

Your tests B and C are clearly same as the usual problem. In your whole 25-lines issue, there is exactly one that is different from the usual problem, while everything else screams it is the usual problem Anyway, I presume you closed the issue because you fixed it? Care to share how?

dev-2-4-h commented 2 years ago

I'm still trying to finger out what causes the problem. I closed the BUG report because I have the impression that it is an issue related to a specific device (OUKITEL K7) that is not really mainstream.

To the point: Of course, I have seen the solution you suggest before posting and disabled the 'Android Setup' app in several ROMs that I tried, but that didn't solve the problem. It is curious that the ROMs B&C ended in a loop while the ROM [lineage-19.1-20220814-UNOFFICIAL-a64_bgS.img.xz] worked normal, using Android Setup including enabling the Fingerprint Sensor. The Sensor worked until I reboot, like with the ROM A&C.

Seeking a solution: I looked at the process (top) but the android.hardware.biometrics.fingerprint was working before and after reset. That rules out that the process is not started. Next on my list is to check if SE Linux somehow bocks the access to TEE or if TEE is not readable. However, I need more knowledge to verify that.

Maybe it is the overall setup of the DEVICE, I noticed that fastboot getvar is not providing info whether I use Slot-A or Slot-B and if I try fastboot --set-active=a I get "Device does not support slots'.

dev-2-4-h commented 1 year ago

No solution!

After extensive research and reading through release notes from Android 9 to 12 I believe that the issue is related to the Hardware Keystore. (https://source.android.com/docs/security/keystore) My device (K7pro) is not really compatible with GSI. While it looks like to be AB, there is no way to switch the slots and only A seems to be used. I believe that OKITEL is using Keymaster 3 with Android 9, while google recommended upgrading to Keymaster 4. For this reason, other GIS images, higher than Android 9 are simply unable to store the Fingerprints. As a result, the device works as long as the fingerprints are in the memory, but once the device reboots they are not accessible and the fingerprint sensor fails. A possible fix would be a full redesigned of the bootloader and the partition layout, a work that I'm not qualified to do and also don't have the time for.

phhusson commented 1 year ago

Having only A slot is normal. keymaster 3 /could/ be an issue, but I'm pretty confident I have working fingerprint on AOSP 10 on keymaster 3 devices

Try setting setprop persist.sys.phh.fingerprint.nocleanup true