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

Commit a8599f5d authored by Andy Mast's avatar Andy Mast
Browse files

Fingerprint: Secure the dump

CTS requires services to be protected.

Change-Id: Id80e8a722c40d6c1ca05da5412dd7589e28d5463

Conflicts:
	services/core/java/com/android/server/fingerprint/FingerprintService.java
parent d0abd02d
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -493,7 +493,15 @@ public class FingerprintService extends SystemService {
         */
        @Override
        protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
            if (args.length != 0 && DUMP_CMD_PRINT_ENROLLMENTS.equals(args[0])) {
            if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
                    != PackageManager.PERMISSION_GRANTED) {
                pw.println("Permission Denial: can't dump telephony.registry from from pid="
                        + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
                return;
            }
            if (mHal == 0) {
                pw.println("Fingerprint sensor not available");
            } else if (args.length != 0 && DUMP_CMD_PRINT_ENROLLMENTS.equals(args[0])) {
                dumpEnrollments(pw, args);
            } else if (args.length >= 3 && DUMP_CMD_SET_FINGER_NAME.equals(args[0])) {
                dumpSetFingerprintName(pw, args);
@@ -560,6 +568,15 @@ public class FingerprintService extends SystemService {
    public void onStart() {
        publishBinderService(Context.FINGERPRINT_SERVICE, new FingerprintServiceWrapper());
        mHal = nativeOpenHal();
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
            if (mHal == 0) {
                throw new RuntimeException(
                        "FEATURE_FINGERPRINT present, but no Fingerprint HAL loaded!");
            }
        } else if (mHal != 0) {
            throw new RuntimeException(
                    "Fingerprint HAL present, but FEATURE_FINGERPRINT is not set!");
        }
    }

}