Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf3b0d66 authored by Jeff Pu's avatar Jeff Pu Committed by Automerger Merge Worker
Browse files

Merge "Simulate finger touch with virtual fingerprint hal" into udc-qpr-dev...

Merge "Simulate finger touch with virtual fingerprint hal" into udc-qpr-dev am: 8474e780 am: 6f32218b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23694823



Change-Id: I6924c82d130c50efc0a35d75b18f4ce5b55bcdcf
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4f51bbe2 6f32218b
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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);
            }
        }
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -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;
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -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) {};
}
+14 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }
}