Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setIsUniqueDeviceAttestationSupported and isUniqueDeviceAttestationSupported support to ShadowDevicePolicyManager #6909

Merged
merged 1 commit into from Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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