Unlock screen lock

I am writing an application to control or customize the unlock screen of Android devices. It works in the following steps:

  • The user locks the screen using the power button.
  • The user tries to unlock the screen, thereby again pressing the power button.
  • My activity pops up - the screen is still locked
  • The user answers the question, and if the answer is correct, the screen unlocks

I created an action for the third step and added the following code to its method onCreate:

Window window = getWindow();

window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE);

This works correctly and accurately, as I had hoped. My problem is the fourth step. I searched and found a number of solutions, but none of them do this for me.

/ - . .

/ Android - , . , . , , . (!)

. . , .

+4
1

mehrdadjg

Android Api ( 23). , KeyguardService root, Android (com.android.systemui.keyguard.KeyguardService.java). Android (IPC helpl) .

...

, - KeyguardViewMediator. "com.android.systemui.keyguard". (, 1157, 1433)

, , Android .

0

Source: https://habr.com/ru/post/1629137/


All Articles