• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/hardware/interfaces-mnstshlylh


Commit MetaInfo

Revisionbb7ef971703f239e8440d2a009cd75597a6b60ba (tree)
Time2019-04-19 08:12:00
AuthorBranden Archer <brarcher@goog...>
CommiterBranden Archer

Log Message

Access Wifi Keystore HAL via binder

The test originally linked against the HAL directly, as well as the
generated stub to access the HAL.. This "worked", however if both the
32-bit and 64-bit versions of the generated stub library were
not present the test would fail. It turned out that on AOSP builds
this was the case, as a 32-bit version of android.system.wifi.keystore
was not present as it was never used at runtime.

To avoid this issue, the stub is now linked statically. Further, the
HAL under test is accessed over binder.

Bug: 130207625
Test: On an AOSP build:

make vts;
vts-tradefed run commandAndExit vts -m VtsHalWifiKeystoreV1_0TargetTest

Change-Id: I02cac1e89c8bed45a4b9b98820c86500327891b6
Merged-In: I138f3e7809a337cec81dccbc52c7a9170acd1d3d

Change Summary

Incremental Difference

--- a/wifi/keystore/1.0/vts/functional/Android.bp
+++ b/wifi/keystore/1.0/vts/functional/Android.bp
@@ -27,15 +27,18 @@ cc_test {
2727 "libhidltransport",
2828 "libnativehelper",
2929 "libutils",
30- "android.system.wifi.keystore@1.0",
31- "libwifikeystorehal",
3230 "libkeystore_binder",
3331 "libbinder",
3432 "libkeystore_aidl",
3533 "libkeystore_parcelables",
3634 "libkeymaster4support",
35+ "libbinderthreadstate",
36+ "libhwbinder",
37+ ],
38+ static_libs: [
39+ "VtsHalHidlTargetTestBase",
40+ "android.system.wifi.keystore@1.0",
3741 ],
38- static_libs: ["VtsHalHidlTargetTestBase"],
3942 cflags: [
4043 "-O0",
4144 "-g",
--- a/wifi/keystore/1.0/vts/functional/VtsHalWifiKeystoreV1_0TargetTest.cpp
+++ b/wifi/keystore/1.0/vts/functional/VtsHalWifiKeystoreV1_0TargetTest.cpp
@@ -17,12 +17,14 @@
1717 #include <android-base/logging.h>
1818
1919 #include <VtsHalHidlTargetTestBase.h>
20+#include <android/security/keystore/IKeystoreService.h>
21+#include <android/system/wifi/keystore/1.0/IKeystore.h>
22+#include <binder/IServiceManager.h>
2023 #include <binder/ProcessState.h>
2124 #include <keymasterV4_0/authorization_set.h>
2225 #include <keystore/keystore_promises.h>
2326 #include <private/android_filesystem_config.h>
2427 #include <utils/String16.h>
25-#include <wifikeystorehal/keystore.h>
2628
2729 using namespace std;
2830 using namespace ::testing;
@@ -30,7 +32,8 @@ using namespace android;
3032 using namespace android::binder;
3133 using namespace android::security::keystore;
3234 using namespace android::security::keymaster;
33-using namespace android::system::wifi::keystore::V1_0;
35+using android::security::keystore::IKeystoreService;
36+using android::system::wifi::keystore::V1_0::IKeystore;
3437
3538 int main(int argc, char** argv) {
3639 // Start thread pool for Binder
@@ -52,7 +55,8 @@ enum KeyPurpose {
5255 class WifiKeystoreHalTest : public Test {
5356 protected:
5457 void SetUp() override {
55- keystore = implementation::HIDL_FETCH_IKeystore(nullptr);
58+ keystore = IKeystore::getService();
59+ ASSERT_TRUE(keystore);
5660
5761 sp<android::IServiceManager> service_manager = android::defaultServiceManager();
5862 sp<android::IBinder> keystore_binder =
@@ -198,7 +202,7 @@ class WifiKeystoreHalTest : public Test {
198202 constexpr static const char kTestKeyName[] = "TestKeyName";
199203 constexpr static const int32_t UID_SELF = -1;
200204
201- IKeystore* keystore = nullptr;
205+ sp<IKeystore> keystore;
202206 sp<IKeystoreService> service;
203207 };
204208
@@ -206,7 +210,7 @@ class WifiKeystoreHalTest : public Test {
206210 * Test for the Wifi Keystore HAL's sign() call.
207211 */
208212 TEST_F(WifiKeystoreHalTest, Sign) {
209- IKeystore::KeystoreStatusCode statusCode;
213+ ::android::system::wifi::keystore::V1_0::IKeystore::KeystoreStatusCode statusCode;
210214
211215 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
212216 const ::android::hardware::hidl_vec<uint8_t>& /*value*/) {