device_safety_info 2.1.1
device_safety_info: ^2.1.1 copied to clipboard
Flutter device security - root/jailbreak, hook and debugger detection, Play Integrity and App Attest tokens, screenshot and clipboard protection, VPN checks.
2.1.1 #
Fixes #
Genuine phones were flagged as rooted or emulators. These are now low risk (reported, not blocking):
- Root: OEM partitions layered onto system folders (
root.system_overlay; Xiaomi, Oppo, vivo, Samsung and other stock ROMs) and read-write vendor/product partitions (root.system_rw_partition). The nativeroot.native_mountscheck no longer flags them. - Root:
ro.debuggable=1on auserbuild, SELinux permissive/disabled, LineageOS root access. - Root: an
subinary, even an executable one (root.su_executable,su/apdinPATH, nativeroot.native_su_present). Engineering, carrier and budget ROMs shipsu. Magisk, KernelSU, APatch and SuperSU files, mounts and apps stay high. - Root: one-click root apps and the legacy Xposed/Substrate installers (
root.root_tool_app). - Emulator:
qemu.hw.mainkeys(emulator.qemu_prop_weak) and the old QEMU malloc-debug library (emulator.file_weak). - Emulator: hardware markers match as a prefix; emulator names are no longer matched inside the build fingerprint.
- App cloning: an unrecognised data folder (
clone.virtual_container:unknown_path). - Play Protect:
play_protect.disabled, which reads a setting that can be stale.
2.1.0 #
Behavior changes #
- Developer options, USB debugging and Wireless debugging are high risk (detected by default).
- Emulator: a
genericfingerprint alone is low risk; high only next to other emulator evidence. - iOS app on a Mac:
rootandhookingreportunsupportedinstead of jailbroken. - Cached results are dropped when the app returns to the foreground.
New #
- Signal
developer_mode.adb_wifi_enabled(Wireless debugging, Android 11+). - Emulator detection for Cuttlefish, Windows Subsystem for Android and Waydroid.
RiskFlag.forResult()andRiskFlag.signals: flags name the signal that fired.IdleTimeoutGuard.reset(context);SecureEditableTextcalls it while typing.
Fixes #
- Android: screenshot blocking, touch filtering, capture overlay and screenshot events survive activity recreation and apply to a late-attached activity.
- Idle timeout counts time in the background and hardware key presses.
- Clipboard auto-clear removes only the plugin's own copy (Android, iOS).
- Screen capture: foldable cover screens and switched-off displays no longer count as mirroring.
- App cloning: an empty or trailing-slash data directory is no longer a virtual container.
- Keyboard and accessibility checks read the system-app flag from the platform service, so hidden OEM packages aren't reported as third-party.
libshadowhook.so/libshadow.soin system folders are low risk (hooking.inline_hook_library), not high: ShadowHook is also used by legitimate SDKs.- StrongBox key generation falls back to the TEE on
ProviderException. - iOS: call end is reported when an audio interruption ends.
- IOC blocklist and pinning match host names with a trailing dot.
- Android screenshot stream below 14 reports
permission_deniedwithout media permission.
2.0.0 #
A rewrite around one entry point, DeviceSafety, with typed results, configurable policies,
stronger native detection and a type-safe platform layer.
This is a breaking release. See MIGRATION.md for every 1.x API and its 2.0 replacement.
Breaking changes #
- Minimum Flutter 3.50 / Dart 3.14.
- iOS: Swift Package Manager only. The podspec is gone; CocoaPods is no longer supported.
- iOS: IOSSecuritySuite 2.3.0 or newer (was 1.9.11). 2.x ships its own privacy manifest
for the
stat/statfscalls it makes, which App Store uploads require; the API this plugin uses is unchanged. - Android: built-in Kotlin. The plugin no longer applies the Kotlin Gradle plugin, ships no Gradle wrapper and no longer filters ABIs (Flutter decides).
READ_PHONE_STATEis no longer declared by the plugin. Apps that want SIM call detection declare and request it themselves; without it, call detection uses VoIP and audio signals only.- One entry point.
DeviceSafetyInfo,VPNCheck,RiskSummary,NewVersionChecker,IOCDomainBlocker,MalwarePackageDetector,ScreenCapture,ScreenRecordingDetector,AppIntegrityand the top-levellib/*.dartlibraries are removed. UseDeviceSafety.*frompackage:device_safety_info/device_safety_info.dart. - Results instead of booleans. Detection APIs return a
CheckResultand never throw. Failures are reported asCheckStatus.errorortimedOutinstead of silently returningfalse. isRealDevice,isScreenLockandisInstalledFromStoreflip meaning. They became the risk checksemulator,posture.screenLockandposture.storeInstall, which are detected in the risky state.- The plugin never closes or uninstalls the app.
exitProcessIfTrueanduninstallIfTrueare removed. Listen toDeviceSafety.threats;DeviceSafety.terminateApp()exists as an explicit opt-in. checkFridaByMaps(),checkRootFilesNative()and the per-check FFI symbols are removed. The native checks are part ofroot,hookinganddebugger.- Signal ids are stable
check.signal[:detail]strings (root.su_executable:/sbin/su) instead of 1.x'ssu:/sbin/sustyle.
New #
DeviceSafetyConfig: per-check policy (off/standard/strict), per-signal level overrides, per-check fail mode (open/closed), cache TTL, timeout, allowlists for accessibility services and notification listeners,trustSystemApps, malware package list, IOC blocklist, expected signing certificates / iOS team id, and a logger.- Tiered results everywhere. Every detection check (root, emulator, hooking, debugger, tampering, developer mode, screen lock, store install, external storage, unknown sources, Play Protect, accessibility, notification listeners, VPN/proxy, screen capture, malware) reports high and low signals and honors the policy.
DeviceSafety.assess(): every check in one platform round trip, run in parallel natively and alongside the C checks, returning aRiskAssessmentwith plain-languageflags.DeviceSafety.threats: a stream of checks that became detected plus live events (screenshot, capture or recording started, tapjacking touch, VPN connected).DeviceSafety.tampering(CheckType.tampering): detects a repackaged or re-signed app by its signing certificate (Android,expectedSigningCertificates) or provisioning-profile team (iOS,expectedIosTeamId).signingInfo()returns the values to configure.- Caching and de-duplication. Results are cached (30 s by default), concurrent calls share one
native call, and every check has a timeout (5 s by default).
hookinganddebuggerare never cached. trustSystemApps(defaulttrue): the accessibility and notification-listener checks don't report preinstalled system apps, which were false positives on stock phones (for example the Samsung launcher's notification listener).enabledListeners()returnsNotificationListenerInfo, andAccessibilityServicehasisSystemApp.- Typed exceptions for action APIs: a sealed
DeviceSafetyExceptionwithUnsupportedPlatformException,PermissionMissingException,NativeFailureExceptionandAttestationException. - Testing support:
package:device_safety_info/testing.dartandDeviceSafety.forTestingfake the platform side in app tests. PrivacyInfo.xcprivacyfor the iOS plugin, declaring itsUserDefaultsuse (reasonCA92.1: the stored "block third-party keyboards" setting).
Fraud signals (Android; iOS reports unsupported) #
DeviceSafety.remoteAccess(CheckType.remoteAccess): remote-control apps used in "support call" scams (AnyDesk, TeamViewer QuickSupport, RustDesk, AirDroid...). High risk when one has an enabled accessibility service, which lets the remote side tap and type.DeviceSafetyConfig.remoteAccessAllowlistfor your own support or MDM tool.DeviceSafety.locationSpoofing(CheckType.locationSpoofing): a mock-location app selected in developer options, or a mock last-known fix (only if the app already holds a location permission).DeviceSafety.appCloning(CheckType.appCloning): the app running inside a cloner (Parallel Space, VirtualXposed), a second user or dual-app space, or a work profile.DeviceSafety.mitm(CheckType.mitm): user-installed CA certificates; high risk while a VPN or proxy routes the traffic.DeviceSafety.keyboard(CheckType.keyboard): a third-party default keyboard; high risk when it also runs an accessibility service. System keyboards, Gboard and SwiftKey are trusted;DeviceSafetyConfig.keyboardAllowlistfor others. On iOS,blockCustomKeyboards(true)plus oneAppDelegateline refuses third-party keyboards.- All five are included in
assess()and have plain-languageRiskFlags.
Protection and strong authentication #
DeviceSafety.deviceKey: EC P-256 signing keys in StrongBox / TEE (Android, with key attestation for a server challenge) or the Secure Enclave (iOS).create,sign(DER ECDSA / SHA-256),info,exists,delete.DeviceSafety.biometric: biometric-approved actions.approvereturns a signature that only a strong fingerprint or face match can produce, so hooking a success callback can't fake it. Adding a fingerprint or face invalidates the key (keyState=invalidated,approvethrowsBiometricException(enrollmentChanged)). Android 10+ and iOS; the plugin now declares the normalUSE_BIOMETRICpermission.- Secure text fields:
SecureInputConfig(.password(),.pin(),.otp()) turns off autocorrect, suggestions, IME learning, autofill and the clipboard menu;SecureFieldGuardblocks screenshots while a field is focused (sharingSecureScreen's block); andSecureEditableTextapplies all of it. DeviceSafety.pinning: anHttpClientthat checks SPKI SHA-256 pins during the TLS handshake, before any request bytes are sent. Works withpackage:httpand dio. A mismatch throwsPinningExceptionand emits apin_mismatch:<host>threat event;spkiPinOfreads a server's pin.- New exceptions in the sealed hierarchy:
BiometricException(withBiometricErrorCode) andPinningException. - New dependency:
crypto.
Platform attestation (developed as 1.7.0, first released here) #
Google Play Integrity on Android and Apple App Attest / DeviceCheck on iOS. The plugin gets the tokens; your server verifies them.
DeviceSafety.integrity:- Android:
isPlayIntegrityAvailable(),preparePlayIntegrity(cloudProjectNumber:),requestPlayIntegrityToken(requestHash:)(standard requests). - iOS:
isAppAttestSupported(),generateAppAttestKey(),attestAppAttestKey(keyId:, challenge:),generateAppAttestAssertion(keyId:, clientData:),isDeviceCheckSupported(),generateDeviceCheckToken().
- Android:
AttestationException/AttestationErrorCode:unsupported,notPrepared,providerInvalid,playServicesUnavailable,network,tooManyRequests,invalidKey,invalidInput,serverUnavailable,unknown.- Play Integrity is opt-in. The plugin compiles against
com.google.android.play:integritybut doesn't ship it; apps that use it addimplementation("com.google.android.play:integrity:1.6.0"). Without it the calls throwAttestationErrorCode.unsupported; nothing crashes. - App Attest needs the
com.apple.developer.devicecheck.appattest-environmententitlement. iOS links the systemDeviceCheckframework; there's no third-party dependency. example/server_dotnetis a reference ASP.NET Core verifier: Play Integrity decoding and policy (including optional licensing, Play Protect, app access risk and recent device activity verdicts), App Attest attestation and assertion validation, and the DeviceCheck APIs.
Stronger detection #
- Modern root (Android): KernelSU, APatch and Magisk 24+ files and binaries (
ksud,apd,resetprop); systemless-root mounts and read-write system partitions (root.mount_marker,root.system_rw,root.system_overlay); installed root-manager apps (root.manager_app, high) and root-cloaking or patching apps (root.cloak_app, low); build propertiesservice.adb.root, SELinux permissive, LineageOS root access andro.debuggable=1on auserbuild (high), andro.build.typeeng/userdebug, unlocked vbmeta andro.allow.mock.location(low). - Frida, Xposed and Zygisk (Android): the C library finds Frida's agent threads
(
hooking.frida_threads), injector file descriptors (hooking.frida_fds) and inline hooks in libc by comparing its code with the file on disk (hooking.text_patched). Kotlin finds LSPosed, EdXposed, Riru, Zygisk and Shamiko mappings (hooking.framework_mapped), Xposed frames in the call stack (hooking.stack_frame), Xposed classes in the process (hooking.xposed_class) and libraries mapped writable and executable (hooking.rwx_library, low). Frida server probes in/data/local/tmp, which apps can't see on Android 10+, were removed.hooking.xposed,hooking.substrateandhooking.shadowhookbecame one signal,hooking.system_library:<lib>. - Emulators: QEMU pipes and vendor emulator files (Genymotion, BlueStacks, Nox, MEmu, LDPlayer, ttVM) and QEMU-only properties (high); x86-only CPU, no motion sensors and a network operator named "Android" (low).
- iOS: a C jailbreak-file check (
root.native_jailbreak_files) running off the main thread, a dyld image scan for injected libraries andDYLD_INSERT_LIBRARIESdetection (hooking.dyld_injection). - Other new signals: ADB enabled, HTTP proxy, external presentation display, debuggable build, and accessibility services that can read window content.
- Hardened C library: on arm64 and x86_64 Android it reads files with direct system calls, so
hooking libc doesn't blind it. Detection strings for Kotlin and C come from one source
(
tool/signatures.json) and are stored encoded, so they don't appear instrings libdsi.soor the DEX. It's built with stack protector,_FORTIFY_SOURCE, full RELRO and a stripped symbol table. C ABI version 2.
Hardening against bypasses #
root,hookinganddebugger: if the Kotlin/Swift half of a check fails but the C half found high-risk evidence, the check still completes as detected (addingintegrity.platform_check_failed) instead of discarding the evidence with the error. This also applies toassess().- Android root: a checker that throws adds
root.checker_error:<checker>instead of silently counting as clean; if every checker throws, the check reportsCheckStatus.error. integrity.layer_mismatch:root_files(low) when the Kotlin and C root-file checks disagree, which means one layer is being hooked.integrity.native_unavailable(low) when the bundled C library can't run on Android or iOS.assess(): an accessibility, notification-listener or malware list the platform couldn't read is an error, never an empty (clean) list.- Android system properties no longer spawn a
getpropprocess when a property is simply unset, and agetpropthat times out is no longer read.
Example app and docs #
- One small page per feature (31 pages in
example/lib/features/), grouped like the README: device checks, fraud signals, screen protection, proving the device and user, live events and tools, and policy settings. Each page shows what the feature does, the code to copy, and a live demo. The app is plain Material. - App integrity runs the full server round trip with
--dart-define=INTEGRITY_SERVER_URL=...(plusPLAY_CLOUD_PROJECT_NUMBERon Android). - Simpler README: install, a three-step quick start, then one short example per feature. Reference material (every option, every signal, fail modes, platform setup, limits, performance) moved to docs/advanced.md.
Internals #
- Platform calls go through Pigeon-generated, type-checked APIs (one host API per feature) and event channels, replacing about 50 string-dispatched method names and 7 hand-wired event channels.
- Dart code is organized as
lib/src/corepluslib/src/features/<feature>/{domain,data,presentation}; Kotlin and Swift ascore/plusfeatures/<feature>/. - The C checks are one
dsi_collect_signals(mask)call (src/dsi.c), built for Android and iOS by a Dart build hook and bound with FFIgen@Nativebindings. They run on a background isolate and are ABI-version checked. - All blocking Android work runs on one shared, bounded background pool; nothing blocking runs on the Android main thread or the Flutter UI isolate.
Performance #
Measured with example/integration_test/perf_test.dart in profile mode on a Galaxy S21 FE
(Android 16); full numbers and method in example/integration_test/PERF_BASELINE.md.
- A cold assessment of the 6 checks 1.x's
RiskSummaryran takes about the same as 1.x (about 108 ms). - Repeat calls within the cache TTL take about 0.01 ms.
- All 15 detection checks, uncached, take about 45 ms in one round trip.
- A single uncached check is slower than 1.x (about 5 ms vs 1.5 ms), because checks now run on a background pool instead of the Android main thread.
1.6.0 #
Root and emulator detection are now tiered: every signal is high or low risk, and the app chooses whether low-risk signals count. Fixes unrooted Xiaomi, Redmi and Samsung phones being blocked as "rooted" since 1.5.4.
New API #
RiskLevel(none/low/high),RiskPolicy(standard/strict) andRiskCheckResult(level,highRiskSignals,lowRiskSignals,signals,isHighRisk,isDetected({policy}),withSignal,fromMap), shared by root and emulator checks.DeviceSafetyInfo.rootCheckreturns aRiskCheckResultwith the root signals found, e.g.path:/system/bin/suorprop:ro.boot.verifiedbootstate=orange.DeviceSafetyInfo.isRooted({RiskPolicy policy = RiskPolicy.standard}):standardcounts only high-risk root signals (same asisRootedDevice);strictalso counts low-risk ones.DeviceSafetyInfo.emulatorCheckandDeviceSafetyInfo.isEmulator({RiskPolicy policy}): the same model for emulator/simulator detection.- Native (Android):
dsi_root_files_level()returns0none /1low /2high.
await DeviceSafetyInfo.isRooted(); // standard: high-risk only
await DeviceSafetyInfo.isRooted(policy: RiskPolicy.strict); // strict: low + high
final root = await DeviceSafetyInfo.rootCheck; // level + signals
await DeviceSafetyInfo.isEmulator(policy: RiskPolicy.strict);
final emulator = await DeviceSafetyInfo.emulatorCheck;
Behavior changes / fixes #
- Android –
isRootedDevicenow returnstrueonly for high-risk signals. 1.5.4 reported many stock, unrooted Xiaomi, Redmi and Samsung devices as rooted: its in-processPATHlookup counted files that merely exist (the oldwhichonly matched files the app can execute) and counted a stockbusybox.- High-risk: executable
su/magisk/daemonsu, Magisk / SuperSU / Superuser artifacts,frida-server,ro.secure=0. - Low-risk (only via
rootCheckorRiskPolicy.strict):busybox, a non-executablesu, unlocked bootloader (ro.boot.verifiedbootstateorange/yellow),test-keysbuilds,ro.bootmoderecovery/fastboot. - The native FFI file check (
checkRootFilesNative) follows the same rule.
- High-risk: executable
- Android –
isRealDevicenow returnsfalseonly for high-risk emulator signals. It used to matchunknown,genericandnoxanywhere in fingerprint / model / manufacturer / brand / device / product, which flagged some real budget phones and GSI ROMs as emulators.- High-risk: emulator hardware (
goldfish,ranchu,vbox86,nox),ro.kernel.qemu=1/ro.boot.qemu=1(new check), SDK / emulator / Genymotion build names, a fingerprint starting withgeneric, orgenericbrand and device. - Low-risk (only via
emulatorCheckorRiskPolicy.strict):unknown,genericornoxinside a single build field.
- High-risk: emulator hardware (
- iOS:
rootCheckreports any IOSSecuritySuite jailbreak hit as high-risk, with IOSSecuritySuite's failure reasons as signals;emulatorCheckreports the Simulator as high-risk.isRootedDevice/isRealDeviceare unchanged on iOS. - Migration: no code changes required. To keep the old, stricter results use
isRooted(policy: RiskPolicy.strict)andisEmulator(policy: RiskPolicy.strict).
Example app #
- Detection section (
example/lib/src/sections/detection_section.dart):- New Root risk level card (
rootCheck) and Emulator risk level card (emulatorCheck): aNone/Low/Highchip, the suggested handling, and every signal taggedHIGH/LOW. - New Strict policy (root + emulator) switch: off =
RiskPolicy.standard, on =RiskPolicy.strict. - New Rooted (selected policy) and Emulator (selected policy) tiles showing
isRooted(policy:)/isEmulator(policy:)for the selected policy. - Updated subtitles: Device is rooted / jailbroken and Real device now state that they count high-risk signals only.
rootCheck/emulatorCheckresults are printed to the console for diagnostics.
- New Root risk level card (
- New reusable widget
example/lib/src/widgets/risk_check_tile.dart(RiskCheckTile).
Docs & tests #
- README: new Root & emulator risk levels section (signal tables, policies, usage), Migrating from 1.5.x, and Example app: tiered checks with a self-contained example screen.
- New
test/risk_check_result_test.dart(parsing, policies, signal merging,rootCheck/emulatorCheckplatform fallbacks) and arootChecktest intest/device_safety_info_test.dart.
1.5.5 #
- Fix (iOS):
copyToClipboard(sensitive: false)was ignored — the pasteboard item was always marked.localOnly, so it never synced via Universal Clipboard..localOnlyis now set only whensensitiveistrue(the default), matching the documented behavior and Android. - iOS: replaced deprecated
kUTTypePlainText(MobileCoreServices) withUTType.plainText(UniformTypeIdentifiers).
1.5.4 #
- Fix:
isRootedDevicecould crash the app on Android withjava.io.InterruptedIOException: read interrupted by close() on another threadorjava.io.IOException: Stream closed.ShellExecutorspawnedwhich su(andmagisk,busybox,daemonsu) and read its stdout/stderr on raw background threads; when the 200 ms timeout destroyed the process, those streams were closed mid-read and the exception escaped on a thread with no handler, killing the process. The root-command check now looks the binaries up inPATHdirectly (the same lookupwhichperforms), so no subprocess or reader thread is created at all, and it is faster. The redundant stderr thread in thegetpropfallback was removed as well. isRootedDevice/isHookednow returnfalseinstead of throwing if a native check fails unexpectedly, so the DartFuturealways completes. Failed checks are not cached.
1.5.3 #
- Breaking:
REQUEST_INSTALL_PACKAGESis no longer declared by the plugin's ownAndroidManifest.xml, so it no longer merges into every consuming app by default — previously every integrator paid the Play Console sensitive-permission review cost for this permission whether or not they usedisUnknownSourcesEnabled, and had to know to opt out viatools:node="remove"if they didn't want it. Apps that callisUnknownSourcesEnabledmust now add<uses-permission android:name= "android.permission.REQUEST_INSTALL_PACKAGES" />to their ownAndroidManifest.xml(see README's Permissions (Android) section). Apps that don't use the feature need no manifest change. Without the permission,isUnknownSourcesEnabledalready degraded tofalsevia the existingSecurityExceptioncatch inUnknownSourcesCheck.kt, so no native code changed.
1.5.2 #
- Fix:
blockScreenshots(true)crashed on iOS withCALayerInvalid("layer ... is a part of cycle in its layer tree") on the very first call, a guaranteed, 100%-reproducible crash on real devices and simulators alike.ScreenshotProtectionHandler.enableScreenshotBlocking()added the secureUITextFieldas a subview of the key window, then re-parented the window's ownCALayerinto that field's secure sublayer — but since the field already lived inside the window's view hierarchy, its secure sublayer was already a descendant ofwindow.layer, so the re-parent made the window layer its own ancestor, an illegal CoreAnimation cycle. The secure field is now hosted in its own separateUIWindowso its layer tree never overlaps the target window's before the re-parent happens.
1.5.1 #
- Fix:
isRootedDevice()crashed with a fatalNoSuchMethodErroron real Android 7.0/7.1 (API 24/25) devices — the exact floor this package's README lists as the minimum supported version (#19).ShellExecutor.ktcalledProcess.destroyForcibly()andProcess.waitFor(long, TimeUnit)unconditionally; both were added in API 26. SinceisRootedDevice()typically runs unconditionally at app startup, this was a guaranteed, 100%-reproducible crash on API 24/25 hardware, not an edge case. Both calls are now guarded byBuild.VERSION.SDK_INT, with a polling-based bounded wait on API 24/25 so the 200ms timeout behavior is preserved instead of falling back to an unboundedwaitFor(). Thanks to @Enrrique-Rojas for the detailed report and diagnosis!
1.5.0 #
Internal restructuring — feature modules, not a rewrite. lib/, the Android Kotlin plugin, and
the iOS Swift plugin are now organized as one vertical slice per feature (root detection, screen
capture, screenshot, clipboard, overlay-attack, call activity, VPN, etc.) instead of a handful of
large files implementing everything inline. This is purely structural — every existing top-level
import (e.g. package:device_safety_info/vpn_check.dart) and every existing DeviceSafetyInfo
member keeps its exact signature and behavior; nothing here is a breaking change. compileSdk
(and the example app's targetSdk) are bumped to 37.
New — screenshot overlay modes:
DeviceSafetyInfo.setScreenshotOverlayMode(mode: ScreenshotOverlayMode, ...)/clearScreenshotOverlayMode()show a real, visible blur/color/image overlay over the active screen whenever a capture or recording is detected — a branded "content hidden" placeholder instead of the plain black rectangleblockScreenshotsalone produces. FLAG_SECURE (Android) and the iOS secure-layer trick prevent the OS from rendering anything at all into a capture, so this overlay is a visible, on-screen-only effect, shown reactively while a capture/recording is active. Android blur requires API 31+ (degrades to a translucent scrim below that); iOS blur uses a system material blur style. Android + iOS.DeviceSafetyInfo.isScreenshotBlocked/toggleScreenshotBlocking()— convenience query/toggle alongside the existingblockScreenshots.
New — screen-recording detection:
ScreenRecordingDetector.isSupported/onScreenRecordingChanged(plusonScreenRecordingStarted/onScreenRecordingStoppedconvenience filters) detect an active screen-recording session, distinct fromisScreenCaptured/onScreenCapturedChanged(which covers screen mirroring/external-display capture). Android: backed by the realWindowManager.addScreenRecordingCallbackAPI, API 35+ only —isSupportedreportsfalsebelow that rather than guessing. iOS has no API distinguishing "recording" from "mirroring/AirPlay" — both surface through the sameUIScreen.isCapturedsignalisScreenCapturedalready uses, soisSupportedis alwaystruethere and the two streams report identically; this is documented onScreenRecordingDetectoritself.- Fix: declared the
android.permission.DETECT_SCREEN_RECORDINGmanifest permission this feature requires (missing in the initial implementation), and made registration fail soft — some OEM builds deny it at runtime even when declared (observed on a Samsung device), which previously crashed with an uncaughtSecurityExceptioninstead of delivering apermission_deniedstream error like the plugin's other permission-gated streams do.
New — SecureScreen widget: a declarative, ref-counted wrapper (SecureScreen(child: ...))
that engages blockScreenshots while mounted and releases it once no SecureScreen remains in the
tree — pure Dart, no native code of its own. Nested/sibling SecureScreens compose correctly.
NewVersionChecker/VersionStatus hardening:
- Fix:
VersionStatus.canUpdateno longer throws on a non-purely-numeric version segment (e.g."1.2.3-beta") — version comparison now degrades unparseable segments to0instead of crashing. - New:
NewVersionChecker(minAppVersion: ...)+VersionStatus.urgency(UpdateUrgency.none/optional/required) — force/required-update support. The threshold is always developer-supplied (your own remote config, or hardcoded), never scraped from the store, since anything parsed out of store HTML/metadata is one layout change away from breaking. - New:
NewVersionChecker(iOSAppStoreId: ...)— an optional numeric App Store ID fallback, retried when the bundle-ID-keyed lookup returns no results (a reported failure mode even for live, published apps). - Fix: both store lookups now fail soft (return
null) on any unexpected response shape, instead of letting aTypeError/FormatExceptionescapegetVersionStatus(). - Fix:
simpleHttpGetnow has a 10s timeout; a hung store endpoint could previously hanggetVersionStatus()indefinitely. - Deliberately not implemented: release-notes/"what's new" extraction — this field is unreliable and inconsistently formatted across both stores; documented as a known limitation in the README instead of shipping a frequently-broken scraper for it.
1.4.1 #
- Fix: iOS builds failing under Flutter's Swift Package Manager integration with
product 'device-safety-info' ... not found in package 'device_safety_info'(#17). Flutter's generatedFlutterGeneratedPluginSwiftPackagerequests each plugin's SPM library product by its pubspec name with underscores replaced by hyphens (device-safety-info), butPackage.swiftdeclared the product with an underscore. The product name now matches the convention used by every other Flutter plugin. Thanks to @jey-avono for reporting and diagnosing this!
1.4.0 #
New checks — Android banking-malware defenses (added in response to advisory coverage of Android banking trojans like TrickMo/PhantomCall):
- New: Notification Listener enumeration —
enabledNotificationListeners/isAnyNotificationListenerEnabledsurface which apps currently hold notification-listener access (the mechanism banking trojans commonly abuse to intercept OTP/SMS notifications). Android only. - New: Unknown-sources / sideloading check —
isUnknownSourcesEnabled. On Android 8+ this can only answer "has this app been granted install rights" (not "has some other app"), a real API limitation documented in the getter's own doc comment. RequiresREQUEST_INSTALL_PACKAGES(query-only, never installs anything) — strip it viatools:node="remove"in your manifest if you don't use this check. - New: Call-screening role —
isCallScreeningRoleAvailable,isCallScreeningRoleHeldByThisApp,openCallScreeningRoleSettings(). Android'sRoleManager.getRoleHolders()(which would reveal which app holds the role) is a privileged system API unavailable to third-party apps — these three cover what's actually achievable: capability check, self-check, and a settings deep-link so the user can review the current holder themselves. Android only, API 29+. - New: Call activity detection —
onCallActivityChangedstream +isCallActivegetter detect when any call (native SIM or a VoIP call from WhatsApp/Teams/Skype/Meet/imo/etc.) starts or ends, without identifying which app is calling (not achievable on either platform). Android:TelephonyManager(SIM, needsREAD_PHONE_STATE) + system-wideAudioManagerrouting state (any VoIP app, generically). iOS:CXCallObserver(CallKit) +AVAudioSessioninterruption notifications. Detect-only, like every other stream in this plugin — no lockdown/navigation policy is embedded. Native listeners only run while the stream has an active subscriber.
Dependency removal (eliminates consumer version-conflict risk from this plugin's own
dependencies:):
- Removed
connectivity_plus,package_info_plus, andhttp— replaced with a nativedevice_safety_info/connectivity_eventsEventChannel, a nativegetPackageInfoMethodChannel call, and a minimaldart:io HttpClient-based helper (lib/src/http/simple_http_get.dart) respectively.VPNCheck,NewVersionChecker, andIOCDomainBlockerare unaffected from the outside.
Toolchain modernization (Flutter 3.47 plugin-template baseline):
- Breaking (iOS): minimum iOS version raised
13.0→16.0. - Fix (iOS — Swift Package Manager):
Package.swiftmoved from the flatios/Package.swifttoios/device_safety_info/Package.swift— the path Flutter's tooling actually scans for plugin SPM support (Plugin.pluginSwiftPackageManifestPathinflutter_tools). The previous flat location was never discovered by Flutter's build system, so SPM support was silently non-functional despite being present; only the CocoaPods path was ever exercised. The native C FFI source now lives in its own SPM target (device_safety_ffi) since SwiftPM doesn't support mixed Swift+C sources in one target. - Dependency: Android toolchain baseline bumped to match the Flutter 3.47 plugin template — Gradle
8.14→9.3.1, Android Gradle Plugin8.12.1→9.1.0, Kotlin2.2.20→2.4.0. - Dependency:
flutter_lintsany→^6.0.0. - Removed the plugin's Kotlin-level (
android/src/test/kotlin) unit test in favor of relying solely on the Dart-level test suite (test/device_safety_info_test.dart) — one less native test dependency (kotlin-test,mockito-core) to keep in sync, and this plugin's actual public surface is the Dart API.
1.3.0 #
- Fix (Android — 16 KB page size):
libdevice_safety_ffi.sois now linked with-Wl,-z,max-page-size=16384/common-page-size=16384, fixing Google Play Console's "native library not 16 KB compatible" warning forarm64-v8aandx86_64. - Fix (Android — build): the plugin module now declares its own self-contained
buildscriptclasspath and explicitly applies the Kotlin Android Gradle plugin, instead of relying on transitive application via Flutter's Gradle plugin — that assumption didn't hold under all AGP/Gradle declarative-plugins{}configurations, causing Kotlin sources to silently not compile andcannot find symbol DeviceSafetyInfoPluginbuild failures (#14). - New: Overlay Attack Detection —
onOverlayAttackDetectedstream andblockTouchesWhenObscured()detect/block touches delivered while another app is drawing an overlay on top of yours (tapjacking). Android only; throwsPlatformException('UNSUPPORTED_PLATFORM', ...)on iOS, where app sandboxing makes cross-app overlays structurally impossible. - New: Clipboard Protection —
copyToClipboard()(withsensitive+autoClearoptions),clearClipboard(), andonClipboardChangedstream. Android:ClipDescription.EXTRA_IS_SENSITIVE(API 33+). iOS:UIPasteboard.expirationDate/.localOnly. Android + iOS. - New:
IOCDomainBlocker— lightweight IOC/C2 domain-reputation lookup (isBlocked,updateBlocklist,loadRemoteBlocklist) to wire into your own HTTP client or WebView guard. Pure Dart, no native dependency. Android + iOS. - New: Malware Package Detection —
MalwarePackageDetector.isPackageInstalled()/scanKnownMalware()check specific package names against a list you supply. Android only. Requires declaring each package name in your app's own<queries>manifest block (Android 11+ package visibility filtering) — this plugin deliberately doesn't request the broaderQUERY_ALL_PACKAGESpermission, which Google Play gates behind manual approval and would be merged into every app depending on this plugin. - New: Accessibility Abuse Detection —
DeviceSafetyInfo.enabledAccessibilityServices/isAnyAccessibilityServiceEnabledreadSettings.Secure.ENABLED_ACCESSIBILITY_SERVICES. Android only, no new permission. - New: Play Protect Status —
DeviceSafetyInfo.playProtectStatusreads thepackage_verifier_user_consentOS setting Play Protect's toggle controls. Android only, no new permission or dependency. (SafetyNet's Verify Apps API, the old documented way to read this, was fully retired in January 2025.) - New: Idle Session Timeout —
IdleTimeoutGuardwidget fires a callback after a period of no touch activity anywhere in the wrapped subtree. Pure Dart, no native code, Android + iOS. - New: Risk Summary —
RiskSummary.evaluate()aggregates the rooted/hooked/debugger/screen-capture/VPN/ screen-lock checks into a list of plain-languageRiskFlags. Pure Dart, no new platform channel calls.
1.2.0 #
- Fix (Android — ANR):
isRootedDeviceandisHookednow run on a background thread pool — eliminates main-thread shell spawning and ANR risk. - Fix (Android — Performance):
SystemPropsCheckernow reads system properties viaandroid.os.SystemPropertiesreflection (zero-cost cache read) before falling back togetpropshell spawn — worst-case latency for 4 property checks drops from ~800 ms to near-zero. - Fix (Android):
ShellExecutormigrated fromRuntime.exec()toProcessBuilder— stdout is now drained concurrently withwaitFor, eliminating a race condition wherereadLine()blocked after the timeout expired. - Fix (Android): API-34
ScreenCaptureCallbackexecutor was never shut down onstopScreenshotDetection()— fixed resource leak. - New (Android): 30-second TTL result cache for
isRootedDeviceandisHooked— repeated polls within the window return immediately without spawning any processes. - Dependency (Android): Kotlin updated
1.9.22→2.2.0; Android Gradle Plugin8.2.2→8.12.1. - Dependency (iOS SPM):
swift-tools-versionbumped5.9→6.0(compiles in Swift 5 language mode — no source changes needed). - Dependency (iOS SPM): IOSSecuritySuite minimum version raised from
1.9.0to1.9.11. - Dependency (Dart): Dart SDK floor raised to
>=3.5.0; Flutter floor raised to>=3.24.0— this also fixes the "Swift Package Manager not supported" flag on pub.dev (pub.dev requires Flutter ≥ 3.19.0 to recognise SPM support).flutter_lintspinned to^6.0.0.
1.1.0 #
- New:
onScreenshotTakenstream — fires when the user takes a screenshot. Android API 34+: usesActivity.ScreenshotCallback(no permission needed). Android API 24–33: usesMediaStoreContentObserver(host app must holdREAD_MEDIA_IMAGESat runtime). iOS:UIApplication.userDidTakeScreenshotNotification(no permission needed). - New:
setRecentsOverlay({int argbColor})— shows a solid-color overlay over the app thumbnail in the recent-apps switcher. Automatically shown on background, hidden on foreground. Android + iOS. - New:
clearRecentsOverlay()— removes the recents overlay. - Fix:
blockScreenshots()now works on iOS via theUITextField.isSecureTextEntrylayer trick — the key window'sCALayeris re-parented into the text field's secure sublayer, which the system protects from screenshots and recordings. - New:
dart:ffinative C/C++ layer — Frida/proc/self/mapsscan + port scan (27042/27043), rootstat()check, and debuggerTracerPidcheck all run below the JVM/Swift runtime, making them significantly harder to hook - New: Swift Package Manager (SPM) support via
Package.swift— Flutter 3.19+ projects can now resolve the plugin without CocoaPods - New:
isDebuggerAttachedAPI — detects attached debuggers via native sysctl (iOS) and TracerPid (Android) - New:
isHookednow implemented on iOS viaIOSSecuritySuite.amIReverseEngineered() - New:
checkFridaByMaps()andcheckRootFilesNative()exposed as standalone public APIs - Fix:
isRootedDevicenow combines native Cstat()check with JVM-level check — false negatives from hookedFile.exists()no longer silently bypass detection - Fix:
isVPNCheckandisRootedDevicewere returningtrueas default on null/error — corrected tofalse - Fix:
ScreenCaptureDetectorwas flagging HDMI monitors and Chromecast as screen captures — fixed withFLAG_PRESENTATIONcheck - Fix:
ro.debuggable=1was incorrectly flagging all developer/debug builds as rooted — removed from root detection - Fix:
com.google.android.packageinstallerwas listed as a trusted store — it is the APK sideload installer; removed - Fix: iOS
#if TARGET_OS_SIMULATORC macro silently had no effect in Swift — corrected to#if targetEnvironment(simulator) - Fix: iOS
UIScreen.main.isCaptureddeprecated in iOS 16 — replaced with scene-based API with fallback - Fix:
blockScreenshots/hideMenureturned success silently whenActivitywas null — now returnserror("NO_ACTIVITY") - Fix:
exitProcess(0)was called beforeresult.success()— Dart Future now resolves before process exits - Fix:
DisplayListenerwas not unregistered on engine detach — memory leak fixed - Fix:
VPNCheckstream now emits initial VPN state immediately on creation - Fix:
ShellExecutortimeout increased from 50 ms to 200 ms; stderr now drained to prevent process hangs - Fix: Production
print()calls replaced withdebugPrint()throughout - Fix: Podspec metadata (version, description, homepage, author) updated from placeholder values
- Removed:
ro.debuggablefalse-positive root indicator - Removed:
com.google.android.packageinstallerfrom trusted stores - Removed: Unused
LaunchModeVersionenum - Removed: Dead pre-API-17 code path in
DevelopmentModeCheck(minSdk is 24)
1.0.3 #
- @magnus-lpa thank you for contributing screen lock issue in iOS
- @UADACID thank you for pointing out 16KB issue in Android fixed
1.0.2 #
Note: This release has breaking changes. On Android plugin now requires the following:
- Android Gradle Plugin >=8.12.1
- Gradle wrapper >=8.13
- Kotlin 2.2.0
1.0.1 #
- Android isRealDevice check issue fixed
1.0.0 #
- Dependency updated
- iOS issue fixed
- Application is installed from store check feature added
- Local and store version check feature added
0.0.9 #
- Dependency updated
- iOS issue fixed
- @jiazeh thank you for contributing
- AndroidManifest.xml issue fixed
0.0.8 #
- iOS issue fixed
0.0.7 #
- Dependency updated
- iOS issue fixed
0.0.6 #
- Dependency updated
- VPN module modification
0.0.5 #
- Dependency updated
- AGP version updated
- Kotlin version updated
- Code refactoring
0.0.4 #
- Dependency updated
- AGP version updated
- Kotlin version updated
- Code refactoring
0.0.3 #
- VPN detection issue fixed in iOS
0.0.2 #
- Example project and documentation updated
0.0.1 #
- Flutter JailBreak, Rooted, Emulator/Simulator, External storage, VPN Detector, Application Update Checker and Screen Lock detection.