diff options
author | Rob Barnes <robbarnes@google.com> | 2018-12-20 16:21:15 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-12-20 16:21:15 -0800 |
commit | 03e04e83dbb9667ac32af26be6df137bcdda853e (patch) | |
tree | ab1a4ef3617cd9b5e94049972c21fde9701c36aa /keystore/java/android/security/KeyStore.java | |
parent | 9d4d53746f91f1fb4e7bc349832cdba817a0fffd (diff) | |
parent | 23ae50885f28790cd016ae05dc9cbf6a61c6a2e5 (diff) |
Merge "Changed uid output parameter from an int array to a list of strings." am: 7eae0132c1 am: 4718f665d4
am: 23ae50885f
Change-Id: Ieefd1262586a3fbcf13999193c1e058abf1e0a8e
Diffstat (limited to 'keystore/java/android/security/KeyStore.java')
-rw-r--r-- | keystore/java/android/security/KeyStore.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java index 6e6ed30fef8c..9361c7c29bcb 100644 --- a/keystore/java/android/security/KeyStore.java +++ b/keystore/java/android/security/KeyStore.java @@ -55,6 +55,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; @@ -315,13 +316,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) { @@ -335,8 +337,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) { |