system/bt
Révision | bd8c5865c9991dd318c7ac47263b527ad7a4cd9b (tree) |
---|---|
l'heure | 2019-06-08 05:27:44 |
Auteur | Martin Brabham <optedoblivion@goog...> |
Commiter | Martin Brabham |
Confirm the presence of BT key when BT ON
After clearing Bluetooth data, the Bluetooth key will be cleared in the
same time. When turn on Bluetooth, NE happened at the step of checking
Bluetooth key.
Bug: 133214365
Test: ahost --host test net_test_bluetooth
Change-Id: I88f5dfae07352a794b304da60e09253c004fb3d4
@@ -59,6 +59,14 @@ class BtifKeystore { | ||
59 | 59 | */ |
60 | 60 | std::string Decrypt(const std::string& input_filename); |
61 | 61 | |
62 | + /** | |
63 | + * Check for existence of keystore key. | |
64 | + * | |
65 | + * This key can be cleared if a user manually wipes bluetooth storage data | |
66 | + * b/133214365 | |
67 | + */ | |
68 | + bool DoesKeyExist(); | |
69 | + | |
62 | 70 | private: |
63 | 71 | std::unique_ptr<keystore::KeystoreClient> keystore_client_; |
64 | 72 | std::mutex api_mutex_; |
@@ -183,7 +183,9 @@ static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl); | ||
183 | 183 | static future_t* init(void) { |
184 | 184 | std::unique_lock<std::recursive_mutex> lock(config_lock); |
185 | 185 | |
186 | - if (is_factory_reset()) delete_config_files(); | |
186 | + if (is_factory_reset() || | |
187 | + (use_key_attestation() && !btif_keystore.DoesKeyExist())) | |
188 | + delete_config_files(); | |
187 | 189 | |
188 | 190 | std::string file_source; |
189 | 191 |
@@ -98,4 +98,8 @@ KeyStoreNativeReturnCode BtifKeystore::GenerateKey(const std::string& name, | ||
98 | 98 | &software_enforced_characteristics); |
99 | 99 | } |
100 | 100 | |
101 | +bool BtifKeystore::DoesKeyExist() { | |
102 | + return keystore_client_->doesKeyExist(kKeyStore); | |
103 | +} | |
104 | + | |
101 | 105 | } // namespace bluetooth |