Changed uid output parameter from an int array to a list of strings.
Why?: 1) Returning an int array is unsafe because it must be allocated in Java and C++ must not change the size. 2) List<Integer> is not supported by AIDL, but List<String> is. I decided it was simpler to pass back integers encoded as strings than to create yet another parcelable.
Bug: b/119616956
Test: ./list_auth_bound_keys_test.sh
Test: Temporarily modified settings app to call listUidsOfAuthBoundKeys
Change-Id: Ibf86864a5df1608a39f438745dde6f2f8c296b66
diff --git a/keystore/keystore_cli_v2.cpp b/keystore/keystore_cli_v2.cpp
index 0500da2..b46b221 100644
--- a/keystore/keystore_cli_v2.cpp
+++ b/keystore/keystore_cli_v2.cpp
@@ -384,7 +384,7 @@
return 1;
}
int32_t aidl_return;
- ::std::vector<int32_t> uids(100);
+ ::std::vector<::std::string> uids;
android::binder::Status status = service->listUidsOfAuthBoundKeys(&uids, &aidl_return);
if (!status.isOk()) {
fprintf(stderr, "Requesting uids of auth bound keys failed with error %s.\n",
@@ -397,8 +397,7 @@
}
printf("Apps with auth bound keys:\n");
for (auto i = uids.begin(); i != uids.end(); ++i) {
- if (*i == 0) break;
- printf("%d\n", *i);
+ printf("%s\n", i->c_str());
}
return 0;
}