DevicePolicyManager.getPasswordQuality(null) returns 0 instead of 131072
<p>I have a password policy admin configured and activated that requires password to have a minimum length and also to have numeric values.</p>

<p>In a separate code block, I am using DevicePolicyManager.getPasswordQuality to check the quality of password on the deivce.</p>

<p>However, when i pass null to the method, i get a password quality of 0(unspecified) regardless of the password quality configured/governed by the active policy admin.</p>

<p>On the other hand, if i explicitly pass my device policy admin as component name to the method call, i get the correct value of password quality.</p>

<p>This is not adequate for me as i need to be able to get the aggregated password quality if more than one device admin is active/installed, which can be accomplished by passing null to the method as per the api docs.</p>

<p>Any pointers here would be of great help to proceed.</p>

<p>Note that i am using level 14(4.0.4) and this is on an emulator.</p>

<p>Here is the code snippet of what worked and what didn't work:</p>

<h1>Whats not working:</h1>

<pre><code>    DevicePolicyManager dpm = (DevicePolicyManager)service.getSystemService(Context.DEVICE_POLICY_SERVICE);
    List&lt;ComponentName&gt; list = dpm.getActiveAdmins();
    ComponentName admin = null;
    String strValue = null;
strValue = String.valueOf(dpm.getPasswordQuality(admin));
//strValue has 0 value indicating password quality as unspecified 
       //although there is one active policy requiring number type password
</code></pre>

<h1>What is working fine:</h1>

<pre><code>    DevicePolicyManager dpm = (DevicePolicyManager)service.getSystemService(Context.DEVICE_POLICY_SERVICE);
    List&lt;ComponentName&gt; list = dpm.getActiveAdmins();
    ComponentName admin = list.get(0);
    String strValue = null;
strValue = String.valueOf(dpm.getPasswordQuality(admin));
//strValue contains 131072 indicating numberic type password 
    // which is what my policy sets[corresponding to component list.get(0)].
</code></pre>

<p>Regards,
Deepak</p>
