NIAP: Make sure that call getOrCreateSecretKey once at a time

Since the getOrGenerate semantic on keystore is not thread safe, need to
synchronize it to make sure that call getOrCreateSecretKey once at a
time.

Bug: 160630406
Test: atest BluetoothInstrumentationTests
Tag: #feature
Change-Id: I182eff28666b7fae76c7207cc430bb132a253a4c
diff --git a/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java b/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java
index f25f367..c838584 100644
--- a/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java
+++ b/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java
@@ -797,7 +797,8 @@
         return keyStore;
     }
 
-    private SecretKey getOrCreateSecretKey() {
+    // The getOrGenerate semantic on keystore is not thread safe, need to synchronized it.
+    private synchronized SecretKey getOrCreateSecretKey() {
         SecretKey secretKey = null;
         try {
             KeyStore keyStore = getKeyStore();