Loading packages/SystemUI/res/values/lineage_bools.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6,4 +6,7 @@ <resources> <!-- Whether the mobile signal icon pipeline should ignore IWlan status --> <bool name="config_mobileIconIgnoresIWlan">false</bool> <!-- Boolean to enable/disable the UDFPS onPress node functionality --> <bool name="config_enableUdfpsSysfsNodes">false</bool> </resources> packages/SystemUI/res/values/lineage_config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,10 @@ <item>4095,0</item> </string-array> <!-- Array of UDFPS node paths --> <string-array name="config_udfpsSysfsNodePaths"> </string-array> <!-- Doze: does the double tap sensor need a proximity check? --> <bool name="doze_double_tap_proximity_check">false</bool> Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +78 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.input.InputManager; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.PowerManager; import android.os.Trace; import android.os.VibrationAttributes; Loading Loading @@ -110,9 +111,14 @@ import dagger.Lazy; import kotlin.Unit; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.Executor; Loading Loading @@ -221,6 +227,52 @@ public class UdfpsController implements DozeReceiver, Dumpable { private boolean mAttemptedToDismissKeyguard; private final Set<Callback> mCallbacks = new HashSet<>(); private final boolean mIsUdfpsNodeFeatureEnabled; private final List<String> mUdfpsSysfsNodePaths; private Handler mHandler; private void updateUdfpsNodes(String value) { if (!mIsUdfpsNodeFeatureEnabled) { Log.d(TAG, "UDFPS node functionality is disabled via overlay."); return; } if (mUdfpsSysfsNodePaths == null || mUdfpsSysfsNodePaths.isEmpty()) { Log.e(TAG, "UDFPS node paths are not properly initialized."); return; } for (String path : mUdfpsSysfsNodePaths) { writeToUdfpsNode(path, value); } } private void writeToUdfpsNode(String path, String value) { mBiometricExecutor.execute(() -> { if (isFileWritable(path)) { try (FileWriter writer = new FileWriter(path)) { writer.write(value); Log.d(TAG, "Successfully set " + path + " to " + value); } catch (IOException e) { Log.e(TAG, "Failed to write to " + path, e); } } }); } private boolean isFileWritable(String path) { File file = new File(path); if (!file.exists()) { Log.e(TAG, "File does not exist: " + path); return false; } if (!file.canWrite()) { Log.e(TAG, "File is not writable: " + path); return false; } return true; } @VisibleForTesting public static final VibrationAttributes UDFPS_VIBRATION_ATTRIBUTES = new VibrationAttributes.Builder() Loading Loading @@ -742,6 +794,19 @@ public class UdfpsController implements DozeReceiver, Dumpable { mSessionTracker = sessionTracker; mDeviceEntryUdfpsTouchOverlayViewModel = deviceEntryUdfpsTouchOverlayViewModel; mDefaultUdfpsTouchOverlayViewModel = defaultUdfpsTouchOverlayViewModel; mHandler = new Handler(Looper.getMainLooper()); mIsUdfpsNodeFeatureEnabled = mContext.getResources().getBoolean( com.android.systemui.res.R.bool.config_enableUdfpsSysfsNodes ); Log.d(TAG, "UDFPS sysfs node feature enabled: " + mIsUdfpsNodeFeatureEnabled); mUdfpsSysfsNodePaths = Arrays.asList( mContext.getResources().getStringArray( com.android.systemui.res.R.array.config_udfpsSysfsNodePaths ) ); Log.d(TAG, "Initialized UDFPS node paths: " + mUdfpsSysfsNodePaths); mDumpManager.registerDumpable(TAG, this); Loading Loading @@ -857,6 +922,13 @@ public class UdfpsController implements DozeReceiver, Dumpable { if (!isOptical()) { return; } // Check if the fingerprint is still pressed before proceeding if (mIsUdfpsNodeFeatureEnabled && mOnFingerDown) { Log.v(TAG, "Fingerprint is still pressed; skipping unconfigureDisplay."); return; } if (DeviceEntryUdfpsRefactor.isEnabled()) { if (mUdfpsDisplayMode != null) { mUdfpsDisplayMode.disable(null); // beverlt Loading Loading @@ -991,6 +1063,9 @@ public class UdfpsController implements DozeReceiver, Dumpable { mFingerprintManager.onUdfpsUiEvent(FingerprintManager.UDFPS_UI_READY, requestId, mSensorProps.sensorId); mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE); mHandler.postDelayed(() -> { updateUdfpsNodes("1"); }, 50); } private void onFingerDown( Loading Loading @@ -1110,6 +1185,9 @@ public class UdfpsController implements DozeReceiver, Dumpable { } } mOnFingerDown = false; updateUdfpsNodes("0"); unconfigureDisplay(view); cancelAodSendFingerUpAction(); } Loading Loading
packages/SystemUI/res/values/lineage_bools.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6,4 +6,7 @@ <resources> <!-- Whether the mobile signal icon pipeline should ignore IWlan status --> <bool name="config_mobileIconIgnoresIWlan">false</bool> <!-- Boolean to enable/disable the UDFPS onPress node functionality --> <bool name="config_enableUdfpsSysfsNodes">false</bool> </resources>
packages/SystemUI/res/values/lineage_config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,10 @@ <item>4095,0</item> </string-array> <!-- Array of UDFPS node paths --> <string-array name="config_udfpsSysfsNodePaths"> </string-array> <!-- Doze: does the double tap sensor need a proximity check? --> <bool name="doze_double_tap_proximity_check">false</bool> Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +78 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.input.InputManager; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.PowerManager; import android.os.Trace; import android.os.VibrationAttributes; Loading Loading @@ -110,9 +111,14 @@ import dagger.Lazy; import kotlin.Unit; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.Executor; Loading Loading @@ -221,6 +227,52 @@ public class UdfpsController implements DozeReceiver, Dumpable { private boolean mAttemptedToDismissKeyguard; private final Set<Callback> mCallbacks = new HashSet<>(); private final boolean mIsUdfpsNodeFeatureEnabled; private final List<String> mUdfpsSysfsNodePaths; private Handler mHandler; private void updateUdfpsNodes(String value) { if (!mIsUdfpsNodeFeatureEnabled) { Log.d(TAG, "UDFPS node functionality is disabled via overlay."); return; } if (mUdfpsSysfsNodePaths == null || mUdfpsSysfsNodePaths.isEmpty()) { Log.e(TAG, "UDFPS node paths are not properly initialized."); return; } for (String path : mUdfpsSysfsNodePaths) { writeToUdfpsNode(path, value); } } private void writeToUdfpsNode(String path, String value) { mBiometricExecutor.execute(() -> { if (isFileWritable(path)) { try (FileWriter writer = new FileWriter(path)) { writer.write(value); Log.d(TAG, "Successfully set " + path + " to " + value); } catch (IOException e) { Log.e(TAG, "Failed to write to " + path, e); } } }); } private boolean isFileWritable(String path) { File file = new File(path); if (!file.exists()) { Log.e(TAG, "File does not exist: " + path); return false; } if (!file.canWrite()) { Log.e(TAG, "File is not writable: " + path); return false; } return true; } @VisibleForTesting public static final VibrationAttributes UDFPS_VIBRATION_ATTRIBUTES = new VibrationAttributes.Builder() Loading Loading @@ -742,6 +794,19 @@ public class UdfpsController implements DozeReceiver, Dumpable { mSessionTracker = sessionTracker; mDeviceEntryUdfpsTouchOverlayViewModel = deviceEntryUdfpsTouchOverlayViewModel; mDefaultUdfpsTouchOverlayViewModel = defaultUdfpsTouchOverlayViewModel; mHandler = new Handler(Looper.getMainLooper()); mIsUdfpsNodeFeatureEnabled = mContext.getResources().getBoolean( com.android.systemui.res.R.bool.config_enableUdfpsSysfsNodes ); Log.d(TAG, "UDFPS sysfs node feature enabled: " + mIsUdfpsNodeFeatureEnabled); mUdfpsSysfsNodePaths = Arrays.asList( mContext.getResources().getStringArray( com.android.systemui.res.R.array.config_udfpsSysfsNodePaths ) ); Log.d(TAG, "Initialized UDFPS node paths: " + mUdfpsSysfsNodePaths); mDumpManager.registerDumpable(TAG, this); Loading Loading @@ -857,6 +922,13 @@ public class UdfpsController implements DozeReceiver, Dumpable { if (!isOptical()) { return; } // Check if the fingerprint is still pressed before proceeding if (mIsUdfpsNodeFeatureEnabled && mOnFingerDown) { Log.v(TAG, "Fingerprint is still pressed; skipping unconfigureDisplay."); return; } if (DeviceEntryUdfpsRefactor.isEnabled()) { if (mUdfpsDisplayMode != null) { mUdfpsDisplayMode.disable(null); // beverlt Loading Loading @@ -991,6 +1063,9 @@ public class UdfpsController implements DozeReceiver, Dumpable { mFingerprintManager.onUdfpsUiEvent(FingerprintManager.UDFPS_UI_READY, requestId, mSensorProps.sensorId); mLatencyTracker.onActionEnd(LatencyTracker.ACTION_UDFPS_ILLUMINATE); mHandler.postDelayed(() -> { updateUdfpsNodes("1"); }, 50); } private void onFingerDown( Loading Loading @@ -1110,6 +1185,9 @@ public class UdfpsController implements DozeReceiver, Dumpable { } } mOnFingerDown = false; updateUdfpsNodes("0"); unconfigureDisplay(view); cancelAodSendFingerUpAction(); } Loading