so here's the problem:
I'm trying to create a Device Admin app where when the user attempts to disable the admin functionality of the app, he is prompted for a password, and if he fails to input the correct password, the app keeps admin privileges.
I've seen an app called AppLock do just this, and it works great! I have experimented with locking the screen from the onDisableRequested() method as suggested in this SO question, but the admin app is disabled anyway.
I'm assuming AppLock locks the screen with a password activity when the user tries to disable the app as admin, but I don't understand how it can stop the app from being disabled on a wrong password, since the app is already in the process of being disabled when the password activity is launched. Is there a hook in a password activity to halt certain processes if the password is incorrect?
I'm also confused about how to implement the custom password lock screen that AppLock is using. How can I temporarily change the lock screen type with a custom password lock screen, then revert to the user's original lock screen type?
These are some other SO questions which were similar to my question: