phhusson / treble_experimentations

Notes about tinkering with Android Project Treble
3.34k stars 657 forks source link

Enable fingerprint halo light for optical sensor on Huawei Mate 20 Pro #468

Open deepsrd opened 5 years ago

deepsrd commented 5 years ago

The mate 20 Pro has a similar optical fingerprint sensor as the Mi9. The halo need to be enabled to it to work properly.

The fingerprint does work however, it needs the scrrrn to be on a high brightness level I have attached the logcat from the Phh-Trable GSI build 112, this is of the fingerprint enrollment using the system app.

deepsrd commented 5 years ago

logcat.txt

phhusson commented 5 years ago

I'm not too sure what you say. Are you saying that you enabled the halo yourself by setting the right properties, and you're now stuck after that?

deepsrd commented 5 years ago

Ah sorry, I meant that the fingerprint scanner works out of the box, but with screen at high brightness.

There is no halo light as is in the stock rom. Means it does not work for unlocking the screen ..

I could not enable it at all..

phhusson commented 5 years ago

Ok, should be fairly easy to fix then.

Basically, you'll need (on my aosp v112) to set the following properties: persist.vendor.sys.fp.fod.location.X_Y persist.vendor.sys.fp.fod.size.width_height which are the position and size of fingerprint sensor For instance here are the values on Mi 9:

Once you do that, android will show you a light green circle where to put your finger, and when you press your finger there, it will make the brightness at 100% while diming the rest of the screen (so as not to blind you if you were at low brightness)

To improve this further, you should set this in a framework-res overlay:

+    <integer translatable="false" name="config_brightness_ramp_rate_fast">10000</integer>
+    <integer translatable="false" name="config_brightness_ramp_rate_slow">10000</integer>
deepsrd commented 5 years ago

Ah cool!!

I will test it and report back..

Thanks a million!

deepsrd commented 5 years ago

Amazing , it works!!

How can I port this to other roms? like Lineage? What changes do I need to pick?

phhusson commented 5 years ago

Could you get me your ro.vendor.build.fingerprint and tell me what values did you use for x_y and width_height?

The patch is at https://github.com/phhusson/platform_frameworks_base/commit/64b2e6d1fc378ac13783f5002e5a9d9379e75f3b

deepsrd commented 5 years ago

I havent fine tuned the location yet, I will post it here once i get the values..

phhusson commented 5 years ago

@deepsrd any news? :-)

deepsrd commented 5 years ago

So sorry, I was on holidays.. I was tinkering with it and i was building xxxhdpi build,and the values i used are 720,1540 .. These are still a bit off, since the coordinates from the stock rom does not match up when I use it on the gsi.. Also, the screen rotation is not supported, minor issue :)

I will experiment more and update here as I get closer..

Diazz72 commented 5 years ago

Are this things fixed. If not do you require something from us ( coordinates...etc ) for a fix?

Thanks and regards, Diazz72.

penn5 commented 5 years ago

He needs coords, size and hal