analyze
Analyzes the device for signs of tampering using the configured detectors.
This function provides the main entry point for device tamper detection. It creates a configuration using the provided block, executes all configured detectors, and returns a confidence score based on the results.
The analysis runs asynchronously and can be called from coroutines. If no configuration is provided, it uses the default detector set.
Example usage:
// Using default detectors
val isTampered = analyze()
// Using custom detectors
val isTampered = analyze {
detector {
add(CommandDetector { arrayOf("su", "busybox") })
add(SystemPropertyDetector { mapOf("ro.secure" to "0") })
}
}Return
A confidence score where: - 1.0 indicates high confidence that tampering is detected - 0.0 indicates no tampering detected - Values between 0.0 and 1.0 indicate varying levels of suspicion
Parameters
Configuration block for setting up tamper detectors. Defaults to using DefaultTamperDetector
Throws
if detection cannot be performed due to security restrictions