diff --git a/common.mk b/common.mk index 8baf67f..0b0e953 100644 --- a/common.mk +++ b/common.mk @@ -179,8 +179,7 @@ PRODUCT_PACKAGES += \ # Fingerprint PRODUCT_PACKAGES += \ - android.hardware.biometrics.fingerprint@2.3-service-samsung.sm7125 \ - SamsungUdfpsHandler.sm7125 + android.hardware.biometrics.fingerprint@2.3-service-samsung.sm7125 # fastbootd PRODUCT_PACKAGES += \ diff --git a/fingerprint/Android.mk b/fingerprint/Android.mk index 576a718..3815590 100644 --- a/fingerprint/Android.mk +++ b/fingerprint/Android.mk @@ -28,7 +28,6 @@ LOCAL_SHARED_LIBRARIES := \ libhidlbase \ liblog \ libutils \ - libcutils \ android.hardware.biometrics.fingerprint@2.1 \ android.hardware.biometrics.fingerprint@2.2 \ android.hardware.biometrics.fingerprint@2.3 diff --git a/fingerprint/BiometricsFingerprint.cpp b/fingerprint/BiometricsFingerprint.cpp index 732f697..49bfb65 100644 --- a/fingerprint/BiometricsFingerprint.cpp +++ b/fingerprint/BiometricsFingerprint.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #ifdef HAS_FINGERPRINT_GESTURES @@ -136,8 +135,6 @@ Return BiometricsFingerprint::isUdfps(uint32_t) { } Return BiometricsFingerprint::onFingerDown(uint32_t, uint32_t, float, float) { - property_set("vendor.finger.down", "1"); - std::thread([this]() { std::this_thread::sleep_for(std::chrono::milliseconds(35)); set(HBM_PATH, "331"); diff --git a/sepolicy/public/property.te b/sepolicy/public/property.te deleted file mode 100644 index 7de6666..0000000 --- a/sepolicy/public/property.te +++ /dev/null @@ -1,2 +0,0 @@ -# Fingerprint -system_public_prop(vendor_fingerprint_prop) diff --git a/sepolicy/vendor/hal_fingerprint_default.te b/sepolicy/vendor/hal_fingerprint_default.te index 18dec7b..ecc0af9 100644 --- a/sepolicy/vendor/hal_fingerprint_default.te +++ b/sepolicy/vendor/hal_fingerprint_default.te @@ -26,7 +26,4 @@ allow hal_fingerprint_default biometrics_vendor_data_file:dir { read write open # /sys/class/sec/tsp/ allow hal_fingerprint_default sysfs_sec_touchscreen:dir search; -allow hal_fingerprint_default sysfs_touchscreen_writable:file { write open getattr }; - -# vendor.finger.down -set_prop(hal_fingerprint_default, vendor_fingerprint_prop) +allow hal_fingerprint_default sysfs_touchscreen_writable:file { write open getattr }; \ No newline at end of file diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index e6528cd..ba633e7 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -9,9 +9,6 @@ persist.vendor.bt. u:object_r:vendor_bluetooth_pro # fastcharge persist.vendor.sec.fastchg_enabled u:object_r:vendor_fastcharge_prop:s0 -# Fingerprint -vendor.finger.down u:object_r:vendor_fingerprint_prop:s0 - # Perf ro.vendor.extension_library u:object_r:vendor_mpctl_prop:s0 diff --git a/sepolicy/vendor/system_app.te b/sepolicy/vendor/system_app.te index edef2d6..e9646ed 100644 --- a/sepolicy/vendor/system_app.te +++ b/sepolicy/vendor/system_app.te @@ -9,8 +9,4 @@ binder_call(system_app, hal_vibrator_default) # MDNIE allow system_app sysfs_mdnie_writable:dir search; -allow system_app sysfs_mdnie_writable:file { open write getattr }; - -# UDFPS -set_prop(system_app, vendor_fingerprint_prop) -get_prop(system_app, vendor_fingerprint_prop) \ No newline at end of file +allow system_app sysfs_mdnie_writable:file { open write getattr }; \ No newline at end of file diff --git a/udfps/Android.mk b/udfps/Android.mk deleted file mode 100644 index a591916..0000000 --- a/udfps/Android.mk +++ /dev/null @@ -1,20 +0,0 @@ -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.sm7125 -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) diff --git a/udfps/AndroidManifest.xml b/udfps/AndroidManifest.xml deleted file mode 100644 index 1718085..0000000 --- a/udfps/AndroidManifest.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/udfps/src/android/hardware/display/BootCompletedReceiver.java b/udfps/src/android/hardware/display/BootCompletedReceiver.java deleted file mode 100644 index 6e399a2..0000000 --- a/udfps/src/android/hardware/display/BootCompletedReceiver.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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); - } -} diff --git a/udfps/src/android/hardware/display/SamsungUdfpsHandlerService.java b/udfps/src/android/hardware/display/SamsungUdfpsHandlerService.java deleted file mode 100644 index e3a8585..0000000 --- a/udfps/src/android/hardware/display/SamsungUdfpsHandlerService.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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; - } -} diff --git a/udfps/src/android/hardware/display/Utils.java b/udfps/src/android/hardware/display/Utils.java deleted file mode 100644 index 070d5f7..0000000 --- a/udfps/src/android/hardware/display/Utils.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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); - } -}