Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9375c9ce authored by Nikolas Havrikov's avatar Nikolas Havrikov Committed by David Zeuthen
Browse files

Replace LinkedList by a more performant collection

This is a semi-automatic change.
See https://errorprone.info/bugpattern/JdkObsolete for the rationale.

Test: make
Bug: 221046110
Change-Id: I84591e3963b54e69570e77354e54027e17f17293
Merged-In: I84591e3963b54e69570e77354e54027e17f17293
parent 140a69e9
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -38,8 +38,9 @@ import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import javax.crypto.BadPaddingException;
@@ -227,7 +228,7 @@ class CredstoreIdentityCredential extends IdentityCredential {
                throw new RuntimeException("Error decoding certificates", e);
            }

            LinkedList<X509Certificate> x509Certs = new LinkedList<>();
            ArrayList<X509Certificate> x509Certs = new ArrayList<>();
            for (Certificate cert : certs) {
                x509Certs.add((X509Certificate) cert);
            }
@@ -384,7 +385,7 @@ class CredstoreIdentityCredential extends IdentityCredential {
    public @NonNull Collection<X509Certificate> getAuthKeysNeedingCertification() {
        try {
            AuthKeyParcel[] authKeyParcels = mBinder.getAuthKeysNeedingCertification();
            LinkedList<X509Certificate> x509Certs = new LinkedList<>();
            ArrayList<X509Certificate> x509Certs = new ArrayList<>();
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            for (AuthKeyParcel authKeyParcel : authKeyParcels) {
                Collection<? extends Certificate> certs = null;
+3 −2
Original line number Diff line number Diff line
@@ -25,8 +25,9 @@ import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

class CredstoreWritableIdentityCredential extends WritableIdentityCredential {

@@ -61,7 +62,7 @@ class CredstoreWritableIdentityCredential extends WritableIdentityCredential {
                throw new RuntimeException("Error decoding certificates", e);
            }

            LinkedList<X509Certificate> x509Certs = new LinkedList<>();
            ArrayList<X509Certificate> x509Certs = new ArrayList<>();
            for (Certificate cert : certs) {
                x509Certs.add((X509Certificate) cert);
            }
+3 −2
Original line number Diff line number Diff line
@@ -18,10 +18,11 @@ package android.security.identity;

import android.annotation.NonNull;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;

/**
 * An object that holds personalization data.
@@ -38,7 +39,7 @@ public class PersonalizationData {
    private PersonalizationData() {
    }

    private LinkedList<AccessControlProfile> mProfiles = new LinkedList<>();
    private ArrayList<AccessControlProfile> mProfiles = new ArrayList<>();

    private LinkedHashMap<String, NamespaceData> mNamespaces = new LinkedHashMap<>();