Android 7.1 Nougat “Panic Detection” Mode Could Help Fight Rogue Apps
Its quite simple, if a rogue applications attempts to hijack the users screen and prevent the user from leaving (perhaps by implementing an Accessibility Service to intercept all key events), Android will itself override the application to bring back the home screen. The user can then presumably uninstall the malicious application right from the launcher.
The thread mentions a thorough breakdown of the code, but the general idea is that “panic detection” pays attention to how many times you press the back button within a certain amount of time. This is in order to differentiate a regular button press from the four button presses needed to activate the feature, with 0.3 seconds per tap acting as the grace period during which panic detection checks for further key presses. This allows the operating system to override the app and send you back to the home screen, particularly useful if a rogue app takes over the display and prevents you from backing out of it. From there, you can uninstall the malicious app and be on your merry way.