Skip to content

Commit

Permalink
Add setIsUniqueDeviceAttestationSupported and isUniqueDeviceAttestati…
Browse files Browse the repository at this point in the history
…onSupported support to ShadowDevicePolicyManager

PiperOrigin-RevId: 413572634
  • Loading branch information
Googler authored and hoisie committed Dec 6, 2021
1 parent bcb31db commit ec93d6e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Expand Up @@ -542,6 +542,14 @@ public void isUninstallBlockedWithNullAdminShouldThrowNullPointerExceptionOnLoll
assertThat(devicePolicyManager.isUninstallBlocked(/* admin= */ null, app)).isTrue();
}

@Test
@Config(minSdk = R)
public void isUniqueDeviceAttestationSupported() {
shadowOf(devicePolicyManager).setIsUniqueDeviceAttestationSupported(true);

assertThat(devicePolicyManager.isUniqueDeviceAttestationSupported()).isTrue();
}

@Test
@Config(minSdk = LOLLIPOP)
public void setApplicationRestrictionsShouldWorkAsIntendedForDeviceOwner() {
Expand Down
Expand Up @@ -98,6 +98,7 @@ public class ShadowDevicePolicyManager {
private long maximumTimeToLock = 0;
private boolean cameraDisabled;
private boolean isActivePasswordSufficient;
private boolean isUniqueDeviceAttestationSupported;
@PasswordComplexity private int passwordComplexity;

private int wipeCalled;
Expand Down Expand Up @@ -294,6 +295,15 @@ protected boolean isUninstallBlocked(@Nullable ComponentName admin, String packa
return uninstallBlockedPackages.contains(packageName);
}

public void setIsUniqueDeviceAttestationSupported(boolean supported) {
isUniqueDeviceAttestationSupported = supported;
}

@Implementation(minSdk = R)
protected boolean isUniqueDeviceAttestationSupported() {
return isUniqueDeviceAttestationSupported;
}

/** @see #setDeviceOwner(ComponentName) */
@Implementation(minSdk = JELLY_BEAN_MR2)
protected String getDeviceOwner() {
Expand Down

0 comments on commit ec93d6e

Please sign in to comment.