title: programmatically enable android device administration
body: <p>I want to write tests for an application that uses the android  <a href="http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html" rel="nofollow">device administration API</a> . My problem is that the user needs to manually grant one-time approval for the application to have admin rights, otherwise a <code>SecurityException</code> is thrown at runtime.</p>
  
  <p>a user can manually enable/disable admin rights for applications by going to settings->location &amp; security -> select device administators. I would like to do it programmatically from within an <code>AndroidTestCase</code>.</p>