/** Window flag: special flag to let windows be shown when the screen * is locked. This will let application windows take precedence over * key guard or any other lock screens. Can be used with * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows * directly before showing the key guard window. Can be used with * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss * non-secure keyguards. This flag only applies to the top-most * full-screen window. */ publicstaticfinalint FLAG_SHOW_WHEN_LOCKED = 0x00080000; // Added in API level 5 /** Window flag: when set as a window is being added or made * visible, once the window has been shown then the system will * poke the power manager's user activity (as if the user had woken * up the device) to turn the screen on. */ publicstaticfinalint FLAG_TURN_SCREEN_ON = 0x00200000; // Added in API level 5 /** Window flag: when set the window will cause the keyguard to * be dismissed, only if it is not a secure lock keyguard. Because such * a keyguard is not needed for security, it will never re-appear if * the user navigates to another window (in contrast to * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily * hide both secure and non-secure keyguards but ensure they reappear * when the user moves to another UI that doesn't hide them). * If the keyguard is currently active and is secure (requires an * unlock pattern) than the user will still need to confirm it before * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has * also been set. */ publicstaticfinalint FLAG_DISMISS_KEYGUARD = 0x00400000; // Added in API Level 5
我们可以看到,这些属性在 API 5 的时候就已经添加进去了。 当锁屏的级别不是保护性(不需要密码)时,FLAG_DISMISS_KEYGUARD 标记可以自动跳过解锁屏操作。该方式__不需要添加任何权限__。