summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2018-12-20 15:53:10 -0800
committerandroid-build-merger <android-build-merger@google.com>2018-12-20 15:53:10 -0800
commit4718f665d49bc0e6c99a94c51a5a81bd48a0e49c (patch)
tree2a85c63e0733a7e9ffaae725d4efad1737fc0216
parent33b2e3d7aca6b265fdc01c43bd0341a3a6e6b3a5 (diff)
parent7eae0132c14861a88233ad3b00e9b2ebb6b22051 (diff)
Merge "Changed uid output parameter from an int array to a list of strings."
am: 7eae0132c1 Change-Id: I4786ab7df710d7bc43ae8153b8c0479a1dbabc7d
-rw-r--r--keystore/java/android/security/KeyStore.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index 6ac52d109032..36b7e37635ca 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -54,6 +54,7 @@ import java.math.BigInteger;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.InvalidKeyException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -303,13 +304,14 @@ public class KeyStore {
}
/**
- * List uids of all keys that are auth bound to the current user.
+ * List uids of all keys that are auth bound to the current user.
* Only system is allowed to call this method.
*/
@UnsupportedAppUsage
public int[] listUidsOfAuthBoundKeys() {
- final int MAX_RESULT_SIZE = 100;
- int[] uidsOut = new int[MAX_RESULT_SIZE];
+ // uids are returned as a list of strings because list of integers
+ // as an output parameter is not supported by aidl-cpp.
+ List<String> uidsOut = new ArrayList<>();
try {
int rc = mBinder.listUidsOfAuthBoundKeys(uidsOut);
if (rc != NO_ERROR) {
@@ -323,8 +325,8 @@ public class KeyStore {
Log.w(TAG, "KeyStore exception", e);
return null;
}
- // Remove any 0 entries
- return Arrays.stream(uidsOut).filter(x -> x > 0).toArray();
+ // Turn list of strings into an array of uid integers.
+ return uidsOut.stream().mapToInt(Integer::parseInt).toArray();
}
public String[] list(String prefix) {