Can I check for a passcode being enabled on Android?
<p><a href="http://stackoverflow.com/questions/11466338/how-to-check-if-a-passcode-or-screenlock-is-set-in-android">This question</a> does not solve my problem, as it only checks for a pattern. </p>

<p>It appears that I can check the device encryption status with the following:</p>

<pre class="lang-java prettyprint-override"><code>Context ctx = this.cordova.getActivity();
DevicePolicyManager mDPM = (DevicePolicyManager)(ctx.getSystemService(Context.DEVICE_POLICY_SERVICE));
boolean encrypted = mDPM.getStorageEncryptionStatus() == mDPM.ENCRYPTION_STATUS_ACTIVE;
</code></pre>

<p>What I would like to be able to do is something similar, but with device passcode status. I've tried (many variations of):</p>

<pre class="lang-java prettyprint-override"><code>Context ctx = this.cordova.getActivity();
DevicePolicyManager mDPM = (DevicePolicyManager)(ctx.getSystemService(Context.DEVICE_POLICY_SERVICE));
ComponentName admin = new ComponentName(ctx, SecurityPlugin.class);
int status = mDPM.getPasswordQuality(admin);
if(status == mDPM.PASSWORD_QUALITY_SOMETHING) { ... }
</code></pre>

<p>but status is always 0. </p>

<p>I've also tried soing something like checking <code>android.provider.Settings.Secure.LOCK_PATTERN_ENABLED</code>, but this returns "Whether autolock is enabled (0 = false, 1 = true)" which is not what I want.</p>
