Merge "Changed uid output parameter from an int array to a list of strings." am: 7eae0132c1
am: 4718f665d4
Change-Id: If50101aa678acb3b7f1b79646c8ff5f1eb994865
This commit is contained in:
@@ -54,6 +54,7 @@ import java.math.BigInteger;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -308,8 +309,9 @@ public class KeyStore {
|
|||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public int[] listUidsOfAuthBoundKeys() {
|
public int[] listUidsOfAuthBoundKeys() {
|
||||||
final int MAX_RESULT_SIZE = 100;
|
// uids are returned as a list of strings because list of integers
|
||||||
int[] uidsOut = new int[MAX_RESULT_SIZE];
|
// as an output parameter is not supported by aidl-cpp.
|
||||||
|
List<String> uidsOut = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
int rc = mBinder.listUidsOfAuthBoundKeys(uidsOut);
|
int rc = mBinder.listUidsOfAuthBoundKeys(uidsOut);
|
||||||
if (rc != NO_ERROR) {
|
if (rc != NO_ERROR) {
|
||||||
@@ -323,8 +325,8 @@ public class KeyStore {
|
|||||||
Log.w(TAG, "KeyStore exception", e);
|
Log.w(TAG, "KeyStore exception", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Remove any 0 entries
|
// Turn list of strings into an array of uid integers.
|
||||||
return Arrays.stream(uidsOut).filter(x -> x > 0).toArray();
|
return uidsOut.stream().mapToInt(Integer::parseInt).toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] list(String prefix) {
|
public String[] list(String prefix) {
|
||||||
|
|||||||
Reference in New Issue
Block a user