Merge "Keystore 2.0 SPI: Make getAttestationIds return an empty array." am: 1f82f476c0

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1664321

Change-Id: Ib28da205d8332e7de5c0ca4710b2704365eb0bf2
This commit is contained in:
Treehugger Robot
2021-04-08 17:06:58 +00:00
committed by Automerger Merge Worker
3 changed files with 6 additions and 7 deletions

View File

@@ -8123,7 +8123,7 @@ package android.security.keystore {
} }
public final class KeyGenParameterSpec implements java.security.spec.AlgorithmParameterSpec { public final class KeyGenParameterSpec implements java.security.spec.AlgorithmParameterSpec {
method @Nullable public int[] getAttestationIds(); method @NonNull public int[] getAttestationIds();
method public int getNamespace(); method public int getNamespace();
} }

View File

@@ -353,7 +353,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
boolean userPresenceRequired, boolean userPresenceRequired,
byte[] attestationChallenge, byte[] attestationChallenge,
boolean devicePropertiesAttestationIncluded, boolean devicePropertiesAttestationIncluded,
int[] attestationIds, @NonNull int[] attestationIds,
boolean uniqueIdIncluded, boolean uniqueIdIncluded,
boolean userAuthenticationValidWhileOnBody, boolean userAuthenticationValidWhileOnBody,
boolean invalidatedByBiometricEnrollment, boolean invalidatedByBiometricEnrollment,
@@ -779,9 +779,8 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
* @return integer array representing the requested device IDs to attest. * @return integer array representing the requested device IDs to attest.
*/ */
@SystemApi @SystemApi
@Nullable public @NonNull int[] getAttestationIds() {
public int[] getAttestationIds() { return mAttestationIds.clone();
return Utils.cloneIfNotNull(mAttestationIds);
} }
/** /**
@@ -911,7 +910,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
private boolean mUserPresenceRequired = false; private boolean mUserPresenceRequired = false;
private byte[] mAttestationChallenge = null; private byte[] mAttestationChallenge = null;
private boolean mDevicePropertiesAttestationIncluded = false; private boolean mDevicePropertiesAttestationIncluded = false;
private int[] mAttestationIds = null; private int[] mAttestationIds = new int[0];
private boolean mUniqueIdIncluded = false; private boolean mUniqueIdIncluded = false;
private boolean mUserAuthenticationValidWhileOnBody; private boolean mUserAuthenticationValidWhileOnBody;
private boolean mInvalidatedByBiometricEnrollment = true; private boolean mInvalidatedByBiometricEnrollment = true;

View File

@@ -655,7 +655,7 @@ public abstract class AndroidKeyStoreKeyPairGeneratorSpi extends KeyPairGenerato
} }
int[] idTypes = mSpec.getAttestationIds(); int[] idTypes = mSpec.getAttestationIds();
if (idTypes == null) { if (idTypes.length == 0) {
return; return;
} }
final Set<Integer> idTypesSet = new ArraySet<>(idTypes.length); final Set<Integer> idTypesSet = new ArraySet<>(idTypes.length);