Secure Input Protection
A PIN entry screen is a high-value target: attackers try to read it via screen capture, steal it through tap-jacking overlays, scrape it with a malicious accessibility service, or capture keystrokes through a compromised third-party keyboard (IME). As a general prerequisite, RASP+ Overlay Detection, Accessibility Misuse Detection, and Malware Detection should be running app-wide — they catch the device- and app-level threats that no per-screen setting can see. Android itself does not ship a dedicated "secure keyboard" component, but you can build the equivalent for the screen itself using standard platform primitives.

There are two supported approaches, in order of strength:
Custom in-app PIN keypad (recommended for PINs). The app draws its own numeric buttons and writes straight into an in-memory buffer. Because no system IME is involved, a keylogging or replacement keyboard has nothing to intercept — the keystrokes never leave your process. This is the closest Android equivalent to a "secure keyboard" for short numeric secrets.
System keyboard, hardened. If you must use a normal text field, force the sensitive
numberPasswordinput type (which suppresses personalized learning and suggestions), disable autofill and the clipboard, and — for the highest assurance — restrict input to the pre-installed system IME rather than any installed third-party keyboard.
Both approaches sit on top of the same screen-level hardening: FLAG_SECURE to block screenshots, screen recording, and the recents thumbnail, and obscured-touch filtering to defeat tap-jacking overlays.
Custom in-app PIN keypad (Compose)
Hardened system keyboard
Jetpack Compose
In Compose, set importantForAutofill = View.IMPORTANT_FOR_AUTOFILL_NO on the host AndroidView/root, or disable autofill for the Activity, since the TextField itself does not expose an autofill flag.
Classic XML / View
Layout (res/layout/activity_pin.xml):
Activity:
filterTouchesWhenObscured and FLAG_SECURE defend the screen locally, but they cannot detect a malicious accessibility service or malware already resident on the device. Keep Talsec Accessibility Misuse Detection, Overlay Detection, and Malware Detection enabled app-wide so those threats are caught before the user ever reaches this screen.
Last updated
Was this helpful?

