compat/src/main/java/androidx/core/content/res/FontResourcesParserCompat.java
public static List<List<byte[]>> readCerts(Resources resources, @ArrayRes int certsId) {
        List<List<byte[]>> certs = null;
        if (certsId != 0) {
            TypedArray typedArray = resources.obtainTypedArray(certsId);
            if (typedArray.length() > 0) {
                certs = new ArrayList<>();
                boolean isArrayOfArrays = typedArray.getResourceId(0, 0) != 0;
                if (isArrayOfArrays) {
                    for (int i = 0; i < typedArray.length(); i++) {
                        int certId = typedArray.getResourceId(i, 0);
                        String[] certsArray = resources.getStringArray(certId);
                        List<byte[]> certsList = toByteArrayList(certsArray);
                        certs.add(certsList);
                    }
                } else {
                    String[] certsArray = resources.getStringArray(certsId);
                    List<byte[]> certsList = toByteArrayList(certsArray);
                    certs.add(certsList);
                }
            }
            typedArray.recycle();
        }
        return certs != null ?  certs : Collections.<List<byte[]>>emptyList();
    }
/**
     * Creates the necessary cert structure given a resources array. This method is capable of
     * loading one string array as well as an array of string arrays.
     */
Creates the necessary cert structure given a resources array. This method is capable of
loading one string array as well as an array of string arrays.
Creates the necessary cert structure given a resources array . This method is capable of loading one string array as well as an array of string arrays .
public static List<List<byte[]>> readCerts(Resources resources, @ArrayRes int certsId) {
        List<List<byte[]>> certs = null;
        if (certsId != 0) {
            TypedArray typedArray = resources.obtainTypedArray(certsId);
            if (typedArray.length() > 0) {
                certs = new ArrayList<>();
                boolean isArrayOfArrays = typedArray.getResourceId(0, 0) != 0;
                if (isArrayOfArrays) {
                    for (int i = 0; i < typedArray.length(); i++) {
                        int certId = typedArray.getResourceId(i, 0);
                        String[] certsArray = resources.getStringArray(certId);
                        List<byte[]> certsList = toByteArrayList(certsArray);
                        certs.add(certsList);
                    }
                } else {
                    String[] certsArray = resources.getStringArray(certsId);
                    List<byte[]> certsList = toByteArrayList(certsArray);
                    certs.add(certsList);
                }
            }
            typedArray.recycle();
        }
        return certs != null ?  certs : Collections.<List<byte[]>>emptyList();
    }
public static List < List < byte [ ] > > readCerts ( Resources resources , @ ArrayRes int certsId ) { List < List < byte [ ] > > certs = null ; if ( certsId != 0 ) { TypedArray typedArray = resources . obtainTypedArray ( certsId ) ; if ( typedArray . length ( ) > 0 ) { certs = new ArrayList < > ( ) ; boolean isArrayOfArrays = typedArray . getResourceId ( 0 , 0 ) != 0 ; if ( isArrayOfArrays ) { for ( int i = 0 ; i < typedArray . length ( ) ; i ++ ) { int certId = typedArray . getResourceId ( i , 0 ) ; String [ ] certsArray = resources . getStringArray ( certId ) ; List < byte [ ] > certsList = toByteArrayList ( certsArray ) ; certs . add ( certsList ) ; } } else { String [ ] certsArray = resources . getStringArray ( certsId ) ; List < byte [ ] > certsList = toByteArrayList ( certsArray ) ; certs . add ( certsList ) ; } } typedArray . recycle ( ) ; } return certs != null ? certs : Collections . < List < byte [ ] > > emptyList ( ) ; }
Creates the necessary cert structure given a resources array.
Creates the necessary cert structure given a resources array .