guacamole: add support for under-screen fingerprint scanner

* Needs corresponding frameworks commit.
* Imported all vendor interfaces to the device tree. This is dirty and
should be fixed from the frameworks side first, e.g. maybe load a .jar
library for FOD, but the code of that .jar library is only present in
device tree.
This commit is contained in:
Peter Cai 2019-06-20 15:29:40 +08:00
parent abb76bfbe2
commit 9b90467bf6
No known key found for this signature in database
GPG Key ID: 71F5FB4E4F3FD54F
17 changed files with 203 additions and 2 deletions

View File

@ -1,3 +1,3 @@
subdirs = [
"lights",
"lights", "interfaces",
]

View File

@ -15,6 +15,7 @@ $(call inherit-product-if-exists, vendor/oneplus/guacamole/guacamole-vendor.mk)
# Overlays
DEVICE_PACKAGE_OVERLAYS += \
$(LOCAL_PATH)/overlay \
$(LOCAL_PATH)/overlay-lineage \
# AID/fs configs
PRODUCT_PACKAGES += \

6
interfaces/Android.bp Normal file
View File

@ -0,0 +1,6 @@
hidl_package_root {
name: "vendor",
path: "device/oneplus/guacamole/interfaces/vendor",
}
subdirs = [ "vendor" ]

View File

@ -0,0 +1,14 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "vendor.oneplus.camera.CameraHIDL@1.0",
root: "vendor",
srcs: [
"IOnePlusCameraProvider.hal",
],
interfaces: [
"android.hidl.base@1.0",
],
gen_java: true,
}

View File

@ -0,0 +1,14 @@
package vendor.oneplus.camera.CameraHIDL@1.0;
interface IOnePlusCameraProvider {
setCameraId(int32_t name) generates (bool status);
setPackageName(string name) generates (bool status);
getPackageName() generates (string cameraDeviceNames);
file_access(string path) generates (bool status);
file_delete(string path) generates (bool status);
file_open(string path) generates (int32_t fd);
file_write(int32_t fd, vec<int8_t> buffer, int32_t size) generates (bool status2);
file_read(int32_t fd, int32_t size) generates (bool status, vec<int8_t> buffer, int32_t size);
file_close(int32_t fd) generates (bool status);
};

View File

@ -0,0 +1,19 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "vendor.oneplus.fingerprint.extension@1.0",
root: "vendor",
srcs: [
"types.hal",
"IVendorFingerprintExtensions.hal",
"IVendorFingerprintExtensionsCallback.hal",
],
interfaces: [
"android.hidl.base@1.0",
],
types: [
"FpTest",
],
gen_java: true,
}

View File

@ -0,0 +1,15 @@
package vendor.oneplus.fingerprint.extension@1.0;
import vendor.oneplus.fingerprint.extension@1.0::types;
import vendor.oneplus.fingerprint.extension@1.0::IVendorFingerprintExtensionsCallback;
interface IVendorFingerprintExtensions {
updateStatus(int32_t status) generates (int32_t debugErrno);
getStatus() generates (int32_t debugErrno2);
getEngTest() generates (vec<FpTest> FpTests);
setEngCallback(IVendorFingerprintExtensionsCallback Callback) generates (int32_t debugErrno);
startEngTest(int32_t cmdId) generates (int32_t debugErrno);
stopEngTest(int32_t cmdId) generates (int32_t debugErrno);
stopAllEngTest() generates (int32_t debugErrno2);
setParam(int32_t level) generates (int32_t debugErrno);
};

View File

@ -0,0 +1,5 @@
package vendor.oneplus.fingerprint.extension@1.0;
interface IVendorFingerprintExtensionsCallback {
oneway onResult(int32_t cmdId, int32_t result, string info);
};

View File

@ -0,0 +1,30 @@
Here are few things I've found while reverse-engineering fingerprint code.
Everything seems to boil down to calls to
vendor.oneplus.fingerprint.extension@1.0.updateStatus()
The value set is output in stock ROM with FingerprintService logcat TAG:
12-27 12:24:07.631 907 1509 D FingerprintService: updateStatus , 8
In real life firmware, the following values have been found:
- 3
- 4
- 8
- 9
Here are few places, and values found in the code:
- services-decompile/sources/com/android/server/fingerprint/FingerprintService.java:
startClient can set status to 3 if client == keyguard, else to 4
It also centralizes statuses (cf next entry).
This indicates some extra values: 8 or 9, though it doesn't set those.
8 and 9 seem to be specific to enrolling
- OPSystemUI/sources/com/android/keyguard/KeyguardUpdateMonitor.java
the mPocketListener can set status to 1 or 2 (probably to suspend the sensor when the phone is in pocket), or event 0
When reading stock ROM logcat, it seems this is the behaviour:
Authentication by SystemUI (== keyguard) sets value to 3
End of auth set values to 4
Settings seem to set status to 8 BEFORE starting enrollment, then when enrolling is called, FingerprintService calls updateStatus to 4
When enrollment is paused, status is set to 9, then back to 8 to resume

View File

@ -0,0 +1,6 @@
package vendor.oneplus.fingerprint.extension@1.0;
struct FpTest {
string name;
int32_t cmdId;
};

View File

@ -0,0 +1,14 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "vendor.oneplus.hardware.display@1.0",
root: "vendor",
srcs: [
"IOneplusDisplay.hal",
],
interfaces: [
"android.hidl.base@1.0",
],
gen_java: true,
}

View File

@ -0,0 +1,5 @@
package vendor.oneplus.hardware.display@1.0;
interface IOneplusDisplay {
setMode(int32_t mode, int32_t enable);
};

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- FOD fingerprint scanner -->
<bool name="config_needCustomFODView">true</bool>
<bool name="config_usesOnePlusFOD">true</bool>
</resources>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Defines the location of the fingerprint sensor on the device
0 = back
1 = front
2 = left side
3 = right side
-->
<integer name="config_fingerprintSensorLocation">1</integer>
</resources>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<dimen name="fingerprint_dot_radius">8dp</dimen>
<item name="fingerprint_sensor_location_fraction_y" type="fraction">85%</item>
</resources>

View File

@ -151,6 +151,9 @@ lib64/libsdm-disp-apis.so
lib64/vendor.display.color@1.0.so
# Fingerprint extensions
-framework/vendor.oneplus.fingerprint.extension-V1.0-java.jar
lib64/vendor.oneplus.fingerprint.extension@1.0.so
lib/vendor.oneplus.fingerprint.extension@1.0.so
# Display extensions (mostly for under-screen fingerprint scanner)
lib64/vendor.oneplus.hardware.display@1.0.so
lib/vendor.oneplus.hardware.display@1.0.so

View File

@ -5,6 +5,10 @@ ro.build.characteristics=nosdcard
ro.setupwizard.mode=OPTIONAL
ro.control_privapp_permissions=log
# Fingerprint
persist.vendor.sys.fp.fod.location.X_Y=595,2527
persist.vendor.sys.fp.fod.size.width_height=250,250
#
# system.prop for sdm845
#