Merge "Simulate finger touch with virtual fingerprint hal" into udc-qpr-dev
This commit is contained in:
@@ -913,7 +913,6 @@ public class FingerprintService extends SystemService {
|
||||
}
|
||||
provider.onPointerDown(requestId, sensorId, pc);
|
||||
}
|
||||
|
||||
@android.annotation.EnforcePermission(android.Manifest.permission.USE_BIOMETRIC_INTERNAL)
|
||||
@Override
|
||||
|
||||
@@ -1184,4 +1183,15 @@ public class FingerprintService extends SystemService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void simulateVhalFingerDown() {
|
||||
if (Utils.isVirtualEnabled(getContext())) {
|
||||
Slog.i(TAG, "Simulate virtual HAL finger down event");
|
||||
final Pair<Integer, ServiceProvider> provider = mRegistry.getSingleProvider();
|
||||
if (provider != null) {
|
||||
provider.second.simulateVhalFingerDown(UserHandle.getCallingUserId(),
|
||||
provider.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ public class FingerprintShellCommand extends ShellCommand {
|
||||
return doHelp();
|
||||
case "sync":
|
||||
return doSync();
|
||||
case "fingerdown":
|
||||
return doSimulateVhalFingerDown();
|
||||
default:
|
||||
getOutPrintWriter().println("Unrecognized command: " + cmd);
|
||||
}
|
||||
@@ -62,6 +64,8 @@ public class FingerprintShellCommand extends ShellCommand {
|
||||
pw.println(" Print this help text.");
|
||||
pw.println(" sync");
|
||||
pw.println(" Sync enrollments now (virtualized sensors only).");
|
||||
pw.println(" fingerdown");
|
||||
pw.println(" Simulate finger down event (virtualized sensors only).");
|
||||
}
|
||||
|
||||
private int doHelp() {
|
||||
@@ -73,4 +77,9 @@ public class FingerprintShellCommand extends ShellCommand {
|
||||
mService.syncEnrollmentsNow();
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int doSimulateVhalFingerDown() {
|
||||
mService.simulateVhalFingerDown();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,4 +157,11 @@ public interface ServiceProvider extends
|
||||
* @param sensorId sensor ID of the associated operation
|
||||
*/
|
||||
default void scheduleWatchdog(int sensorId) {}
|
||||
|
||||
/**
|
||||
* Simulate fingerprint down touch event for virtual HAL
|
||||
* @param userId user ID
|
||||
* @param sensorId sensor ID
|
||||
*/
|
||||
default void simulateVhalFingerDown(int userId, int sensorId) {};
|
||||
}
|
||||
|
||||
@@ -857,4 +857,18 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
||||
}
|
||||
biometricScheduler.startWatchdog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulateVhalFingerDown(int userId, int sensorId) {
|
||||
Slog.d(getTag(), "Simulate virtual HAL finger down event");
|
||||
final AidlSession session = mFingerprintSensors.get(sensorId).getSessionForUser(userId);
|
||||
final PointerContext pc = new PointerContext();
|
||||
try {
|
||||
session.getSession().onPointerDownWithContext(pc);
|
||||
session.getSession().onUiReady();
|
||||
session.getSession().onPointerUpWithContext(pc);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(getTag(), "failed hal operation ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user