Keystore 2.0 SPI: Make getAttestationIds return an empty array.
getAttestationIds shall return an empty array instead of null. Bug: 184026478 Test: N/A Change-Id: I6c6233fa50a83cf7d6354d2783525704a3b39d0d
This commit is contained in:
@@ -8123,7 +8123,7 @@ package android.security.keystore {
|
||||
}
|
||||
|
||||
public final class KeyGenParameterSpec implements java.security.spec.AlgorithmParameterSpec {
|
||||
method @Nullable public int[] getAttestationIds();
|
||||
method @NonNull public int[] getAttestationIds();
|
||||
method public int getNamespace();
|
||||
}
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
|
||||
boolean userPresenceRequired,
|
||||
byte[] attestationChallenge,
|
||||
boolean devicePropertiesAttestationIncluded,
|
||||
int[] attestationIds,
|
||||
@NonNull int[] attestationIds,
|
||||
boolean uniqueIdIncluded,
|
||||
boolean userAuthenticationValidWhileOnBody,
|
||||
boolean invalidatedByBiometricEnrollment,
|
||||
@@ -779,9 +779,8 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
|
||||
* @return integer array representing the requested device IDs to attest.
|
||||
*/
|
||||
@SystemApi
|
||||
@Nullable
|
||||
public int[] getAttestationIds() {
|
||||
return Utils.cloneIfNotNull(mAttestationIds);
|
||||
public @NonNull int[] getAttestationIds() {
|
||||
return mAttestationIds.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -911,7 +910,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
|
||||
private boolean mUserPresenceRequired = false;
|
||||
private byte[] mAttestationChallenge = null;
|
||||
private boolean mDevicePropertiesAttestationIncluded = false;
|
||||
private int[] mAttestationIds = null;
|
||||
private int[] mAttestationIds = new int[0];
|
||||
private boolean mUniqueIdIncluded = false;
|
||||
private boolean mUserAuthenticationValidWhileOnBody;
|
||||
private boolean mInvalidatedByBiometricEnrollment = true;
|
||||
|
||||
@@ -655,7 +655,7 @@ public abstract class AndroidKeyStoreKeyPairGeneratorSpi extends KeyPairGenerato
|
||||
}
|
||||
|
||||
int[] idTypes = mSpec.getAttestationIds();
|
||||
if (idTypes == null) {
|
||||
if (idTypes.length == 0) {
|
||||
return;
|
||||
}
|
||||
final Set<Integer> idTypesSet = new ArraySet<>(idTypes.length);
|
||||
|
||||
Reference in New Issue
Block a user