Identity Credential: Apply changes identified in API review.

Bug: 150817385
Test: atest android.security.identity.cts
Merged-In: I4e005fa7a81ef363a80278224bb706441dad2241
Change-Id: I25e09df09e8a56dc7f639b2aa4636af0166d5050
This commit is contained in:
David Zeuthen
2020-03-05 10:10:27 -05:00
parent ea494a7c19
commit d50b281a32
7 changed files with 17 additions and 18 deletions

View File

@@ -66,7 +66,7 @@ class CredstoreResultData extends ResultData {
}
@Override
public @NonNull Collection<String> getNamespaceNames() {
public @NonNull Collection<String> getNamespaces() {
return Collections.unmodifiableCollection(mData.keySet());
}

View File

@@ -105,11 +105,11 @@ class CredstoreWritableIdentityCredential extends WritableIdentityCredential {
n++;
}
Collection<String> namespaceNames = personalizationData.getNamespaceNames();
Collection<String> namespaces = personalizationData.getNamespaces();
EntryNamespaceParcel[] ensParcels = new EntryNamespaceParcel[namespaceNames.size()];
EntryNamespaceParcel[] ensParcels = new EntryNamespaceParcel[namespaces.size()];
n = 0;
for (String namespaceName : namespaceNames) {
for (String namespaceName : namespaces) {
PersonalizationData.NamespaceData nsd =
personalizationData.getNamespaceData(namespaceName);

View File

@@ -209,6 +209,11 @@ public abstract class IdentityCredential {
* <p>Note that only items referenced in {@code entriesToRequest} are returned - the
* {@code requestMessage} parameter is only used to for enforcing reader authentication.
*
* <p>The reason for having {@code requestMessage} and {@code entriesToRequest} as separate
* parameters is that the former represents a request from the remote verifier device
* (optionally signed) and this allows the application to filter the request to not include
* data elements which the user has not consented to sharing.
*
* @param requestMessage If not {@code null}, must contain CBOR data conforming to
* the schema mentioned above.
* @param entriesToRequest The entries to request, organized as a map of namespace

View File

@@ -46,7 +46,7 @@ public class PersonalizationData {
return Collections.unmodifiableCollection(mProfiles);
}
Collection<String> getNamespaceNames() {
Collection<String> getNamespaces() {
return Collections.unmodifiableCollection(mNamespaces.keySet());
}
@@ -120,7 +120,7 @@ public class PersonalizationData {
* @param value The value to add, in CBOR encoding.
* @return The builder.
*/
public @NonNull Builder setEntry(@NonNull String namespace, @NonNull String name,
public @NonNull Builder putEntry(@NonNull String namespace, @NonNull String name,
@NonNull Collection<AccessControlProfileId> accessControlProfileIds,
@NonNull byte[] value) {
NamespaceData namespaceData = mData.mNamespaces.get(namespace);

View File

@@ -152,7 +152,7 @@ public abstract class ResultData {
* @return collection of name of namespaces containing retrieved entries. May be empty if no
* data was retrieved.
*/
public abstract @NonNull Collection<String> getNamespaceNames();
public abstract @NonNull Collection<String> getNamespaces();
/**
* Get the names of all entries.
@@ -196,8 +196,7 @@ public abstract class ResultData {
* @param name the name of the entry to get the value for.
* @return the status indicating whether the value was retrieved and if not, why.
*/
@Status
public abstract int getStatus(@NonNull String namespaceName, @NonNull String name);
public abstract @Status int getStatus(@NonNull String namespaceName, @NonNull String name);
/**
* Gets the raw CBOR data for the value of an entry.