Loading src/com/android/settings/enterprise/DevicePolicyManagerWrapper.java +7 −0 Original line number Diff line number Diff line Loading @@ -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()}. * Loading src/com/android/settings/enterprise/DevicePolicyManagerWrapperImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java +6 −3 Original line number Diff line number Diff line Loading @@ -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 Loading tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -231,6 +231,7 @@ public final class EnterprisePrivacyFeatureProviderImplTest { @Test public void testGetMaximumFailedPasswordsForWipeInCurrentUser() { when(mDevicePolicyManager.getDeviceOwnerComponentOnCallingUser()).thenReturn(null); when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(null); when(mDevicePolicyManager.getMaximumFailedPasswordsForWipe(OWNER, MY_USER_ID)) .thenReturn(10); Loading @@ -238,6 +239,10 @@ public final class EnterprisePrivacyFeatureProviderImplTest { when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(OWNER); assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInCurrentUser()).isEqualTo(10); when(mDevicePolicyManager.getDeviceOwnerComponentOnCallingUser()).thenReturn(OWNER); when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(null); assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInCurrentUser()).isEqualTo(10); } @Test Loading Loading
src/com/android/settings/enterprise/DevicePolicyManagerWrapper.java +7 −0 Original line number Diff line number Diff line Loading @@ -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()}. * Loading
src/com/android/settings/enterprise/DevicePolicyManagerWrapperImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading
src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java +6 −3 Original line number Diff line number Diff line Loading @@ -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 Loading
tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -231,6 +231,7 @@ public final class EnterprisePrivacyFeatureProviderImplTest { @Test public void testGetMaximumFailedPasswordsForWipeInCurrentUser() { when(mDevicePolicyManager.getDeviceOwnerComponentOnCallingUser()).thenReturn(null); when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(null); when(mDevicePolicyManager.getMaximumFailedPasswordsForWipe(OWNER, MY_USER_ID)) .thenReturn(10); Loading @@ -238,6 +239,10 @@ public final class EnterprisePrivacyFeatureProviderImplTest { when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(OWNER); assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInCurrentUser()).isEqualTo(10); when(mDevicePolicyManager.getDeviceOwnerComponentOnCallingUser()).thenReturn(OWNER); when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(null); assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInCurrentUser()).isEqualTo(10); } @Test Loading