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

Commit b16c7e3d authored by joshmccloskey's avatar joshmccloskey
Browse files

Ensure negative latencies are not being reported

Ensure that BiometricsService will not report negative latencies.
Test: Manual
Bug: 148408637

Change-Id: Ie6a22ebeff4711b5f51c787392e00cc8daf9129c
parent 7f99ea08
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ public abstract class LoggableMonitor {
                error,
                vendorCode,
                Utils.isDebugEnabled(context, targetUserId),
                latency);
                sanitizeLatency(latency));
    }

    protected final void logOnAuthenticated(Context context, boolean authenticated,
@@ -165,7 +165,7 @@ public abstract class LoggableMonitor {
                statsClient(),
                requireConfirmation,
                authState,
                latency,
                sanitizeLatency(latency),
                Utils.isDebugEnabled(context, targetUserId));
    }

@@ -183,8 +183,16 @@ public abstract class LoggableMonitor {
        FrameworkStatsLog.write(FrameworkStatsLog.BIOMETRIC_ENROLLED,
                statsModality(),
                targetUserId,
                latency,
                sanitizeLatency(latency),
                enrollSuccessful);
    }

    private long sanitizeLatency(long latency) {
        if (latency < 0) {
            Slog.w(TAG, "found a negative latency : " + latency);
            return -1;
        }
        return latency;
    }

}