title: Android - Password Protected Device Admin Disablement
body: <p>so here's the problem:</p>
  
  <p>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.  </p>
  
  <p>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 <a href="https://stackoverflow.com/questions/11910624/require-pass-code-to-disable-android-device-administrator?rq=1">this SO question</a>, but the admin app is disabled anyway.</p>
  
  <p>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?</p>
  
  <p>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?</p>
  
  <p>These are some other SO questions which were similar to my question:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/15750816/how-to-prevent-a-user-from-disabling-my-device-admin-app-through-the-settings-m">How to prevent a user from disabling my device admin app, through the settings menu?</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/19856344/ask-password-before-disabling-application-as-admin-in-android">Require a password before disabling application as admin in Android</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/15898971/android-ask-password-on-disabling-app-from-device-admin">Android ask password on disabling app from device admin?</a></p></li>
  </ul>