a32: Implement OSS fingerprint HAL

Signed-off-by: santhosh6194 <santhosh6194@gmail.com>

a32: Rebase and kill Samsung's fingerprint interface

a32: Add UdfpsHandler for NightDisplay and ExtraDim

* Optical fingerprint sensors don't like NightDisplay and ExtraDim since those decrease overall sensor accuracy
* Turn ExtraDim off and set NightDisplay's color temperature to AOSP's default white balance value if the fingerprint sensor is touched

Change-Id: I6651cd5c8c066102feebfb764184b099c6ad741d

a32: fingerprint: Send onFingerUp() on postEnroll and cancel FP

Change-Id: I1b788b43d421853afd42dd1b2a4b75b644498a3f

a32: interfaces: Fix prefix

a32: interfaces: Do not hardcode src

a32: Import and adapt fingerprint hal for a32

* Source "https://github.com/Ryzen5950XT/android_device_samsung_sm7125-common-AOSP"

Signed-off-by: santhosh6194 <santhosh6194@gmail.com>

a32: Switch to fingerprint 2.3 hal

Signed-off-by: santhosh6194 <santhosh6194@gmail.com>

a32: Switch to UDFPS

a32: fod: Set correct fod positions and remove fod_rect

Signed-off-by: santhosh6194 <santhosh6194@gmail.com>
Co-Authored-By: Tim Zimmermann <43107815+Linux4@users.noreply.github.com>

Update BoardConfig.mk
This commit is contained in:
santhosh6194 2021-12-30 02:14:00 +05:30 • committed by AndroidHQ254
commit efe73eae28
No known key found for this signature in database
GPG key ID: 48008337615EE8A9
5 changed files with 1166 additions and 11 deletions

20
udfps/Android.mk Normal file
View file

@ -0,0 +1,20 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := SamsungUdfpsHandler.a32
LOCAL_CERTIFICATE := platform
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_PRIVILEGED_MODULE := true
LOCAL_USE_AAPT2 := true
ifneq ($(INCREMENTAL_BUILDS),)
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_JACK_ENABLED := incremental
endif
include $(BUILD_PACKAGE)

28
udfps/AndroidManifest.xml Normal file
View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.hardware.display"
android:versionCode="1"
android:versionName="1.0"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-sdk
android:targetSdkVersion="28"/>
<application
android:label="SamsungUdfpsHandler"
android:persistent="true">
<receiver android:name=".BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<service android:name=".SamsungUdfpsHandlerService"
android:permission="SamsungUdfpsHandlerService">
</service>
</application>
</manifest>

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2022 The LineageOS 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.
*/
package android.hardware.display;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class BootCompletedReceiver extends BroadcastReceiver {
private static final boolean DEBUG = false;
private static final String TAG = "SamsungUdfpsHandler";
@Override
public void onReceive(final Context context, Intent intent) {
if (DEBUG) Log.d(TAG, "Received boot completed intent");
Utils.startService(context);
}
}

View file

@ -0,0 +1,107 @@
/*
* Copyright (c) 2022 The LineageOS 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.
*/
package android.hardware.display;
import android.app.Service;
import android.content.Intent;
import android.hardware.display.ColorDisplayManager;
import android.os.SystemProperties;
import android.os.IBinder;
import android.util.Log;
import android.os.Handler;
public class SamsungUdfpsHandlerService extends Service {
private static final String TAG = "SamsungUdfpsHandler";
private static final boolean DEBUG = false;
private int mNightDisplayTemp = 0;
private boolean mExtraDimActive = false;
private ColorDisplayManager mColorDisplayManager;
private Handler mHandler;
private static Runnable mRunnable;
private void disable() {
if (DEBUG) Log.d(TAG, "Finger down, set NightDisplay and ExtraDim off");
mNightDisplayTemp = mColorDisplayManager.getNightDisplayColorTemperature();
if (mColorDisplayManager.isNightDisplayActivated()) {
// 6500 Kelvin is AOSP's default white balance value
mColorDisplayManager.setNightDisplayColorTemperature(6500);
}
if (mColorDisplayManager.isReduceBrightColorsActivated()) {
mExtraDimActive = true;
mColorDisplayManager.setReduceBrightColorsActivated(false);
}
SystemProperties.set("vendor.finger.down", "0");
}
private void enable() {
if (DEBUG) Log.d(TAG, "Finger up, reset NightDisplay and ExtraDim to previous state");
SystemProperties.set("vendor.finger.down", "-1");
mColorDisplayManager.setNightDisplayColorTemperature(mNightDisplayTemp);
mColorDisplayManager.setReduceBrightColorsActivated(mExtraDimActive);
mExtraDimActive = false;
}
@Override
public void onCreate() {
if (DEBUG) Log.d(TAG, "SamsungUdfpsHandler Started");
mColorDisplayManager = getSystemService(ColorDisplayManager.class);
SystemProperties.set("vendor.finger.down", "-1");
mHandler = new Handler();
mRunnable = new Runnable() {
public void run() {
if (DEBUG) Log.d(TAG, "onCreate: " + TAG + " is running");
if (SystemProperties.get("vendor.finger.down").equals("1")) {
disable();
try {
Thread.sleep(2000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
} else if (SystemProperties.get("vendor.finger.down").equals("0")) {
enable();
}
mHandler.postDelayed(mRunnable, 100);
}
};
mHandler.postDelayed(mRunnable, 0);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (DEBUG) Log.d(TAG, "Starting service");
return START_STICKY;
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}

View file

@ -0,0 +1,40 @@
/*
* Copyright (C) 2022 The LineageOS 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.
*/
package android.hardware.display;
import android.content.Context;
import android.content.Intent;
import android.os.UserHandle;
import android.util.Log;
public final class Utils {
private static final String TAG = "UDFPSUtils";
private static final boolean DEBUG = false;
protected static void startService(Context context) {
if (DEBUG) Log.d(TAG, "Starting service");
context.startServiceAsUser(new Intent(context, SamsungUdfpsHandlerService.class),
UserHandle.CURRENT);
}
protected static void stopService(Context context) {
if (DEBUG) Log.d(TAG, "Stopping service");
context.stopServiceAsUser(new Intent(context, SamsungUdfpsHandlerService.class),
UserHandle.CURRENT);
}
}