android - DevicePolicyManager.getPasswordQuality(null) returns 0 instead of 131072 -
i have password policy admin configured , activated requires password have minimum length , have numeric values.
in separate code block, using devicepolicymanager.getpasswordquality check quality of password on deivce.
however, when pass null method, password quality of 0(unspecified) regardless of password quality configured/governed active policy admin.
on other hand, if explicitly pass device policy admin component name method call, correct value of password quality.
this not adequate me need able aggregated password quality if more 1 device admin active/installed, can accomplished passing null method per api docs.
any pointers here of great proceed.
note using level 14(4.0.4) , on emulator.
here code snippet of worked , didn't work:
whats not working:
devicepolicymanager dpm = (devicepolicymanager)service.getsystemservice(context.device_policy_service); list<componentname> list = dpm.getactiveadmins(); componentname admin = null; string strvalue = null; strvalue = string.valueof(dpm.getpasswordquality(admin)); //strvalue has 0 value indicating password quality unspecified //although there 1 active policy requiring number type password
what working fine:
devicepolicymanager dpm = (devicepolicymanager)service.getsystemservice(context.device_policy_service); list<componentname> list = dpm.getactiveadmins(); componentname admin = list.get(0); string strvalue = null; strvalue = string.valueof(dpm.getpasswordquality(admin)); //strvalue contains 131072 indicating numberic type password // policy sets[corresponding component list.get(0)].
regards, deepak
Comments
Post a Comment