Merge "Fix "max failed login attempts" disclosure" into oc-dr1-dev

This commit is contained in:
Bartosz Fabianowski
2017-07-25 10:14:50 +00:00
committed by Android (Google) Code Review
4 changed files with 23 additions and 3 deletions

View File

@@ -44,6 +44,13 @@ public interface DevicePolicyManagerWrapper {
*/
int getMaximumFailedPasswordsForWipe(@Nullable ComponentName admin, int userHandle);
/**
* Calls {@code DevicePolicyManager.getDeviceOwnerComponentOnCallingUser()}.
*
* @see android.app.admin.DevicePolicyManager#getDeviceOwnerComponentOnCallingUser
*/
ComponentName getDeviceOwnerComponentOnCallingUser();
/**
* Calls {@code DevicePolicyManager.getDeviceOwnerComponentOnAnyUser()}.
*

View File

@@ -41,6 +41,11 @@ public class DevicePolicyManagerWrapperImpl implements DevicePolicyManagerWrappe
return mDpm.getMaximumFailedPasswordsForWipe(admin, userHandle);
}
@Override
public ComponentName getDeviceOwnerComponentOnCallingUser() {
return mDpm.getDeviceOwnerComponentOnCallingUser();
}
@Override
public ComponentName getDeviceOwnerComponentOnAnyUser() {
return mDpm.getDeviceOwnerComponentOnAnyUser();

View File

@@ -158,11 +158,14 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
@Override
public int getMaximumFailedPasswordsBeforeWipeInCurrentUser() {
final ComponentName profileOwner = mDpm.getProfileOwnerAsUser(MY_USER_ID);
if (profileOwner == null) {
ComponentName owner = mDpm.getDeviceOwnerComponentOnCallingUser();
if (owner == null) {
owner = mDpm.getProfileOwnerAsUser(MY_USER_ID);
}
if (owner == null) {
return 0;
}
return mDpm.getMaximumFailedPasswordsForWipe(profileOwner, MY_USER_ID);
return mDpm.getMaximumFailedPasswordsForWipe(owner, MY_USER_ID);
}
@Override