Skip to content
Commit 26fccb7d authored by Pavel Grafov's avatar Pavel Grafov
Browse files

Throw if admin sets password constraints that have no effect.

For admin apps targeting R+, throw when the app sets password requirement
that is not taken into account at  given quality, e.g. when quality is set
to UNSPECIFIED, it doesn't make sense to require certain password length.
If the intent is to require a password of certain length having at least
NUMERIC quality, the admin should first call setPasswordQuality() and only
then call setPasswordMinimumLength().

Conversely when an admin targeting R+ lowers password quality, those
requiremnts that stop making sense, are reset to default values.

+ fix the behaviour of getPasswordMinimumLength to match the docs: only
  admins with password quality >= NUMERIC should be taken into account.

Test: com.android.cts.devicepolicy..MixedDeviceOwnerTest#testResetPasswordWithToken
Test: com.android.cts.devicepolicy.DeviceAdminHostSideTestApi23#testRunDeviceOwnerPasswordTest
Test: com.android.cts.devicepolicy.MixedDeviceOwnerTestApi#testPasswordRequirementsApi
Test: com.android.cts.devicepolicy.MixedDeviceOwnerTestApi25#testPasswordRequirementsApi
Bug: 123562444
Change-Id: Id134a7918718e3b0a220caaf6c672df4238a062c
parent e75b4a7d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment