Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95399441 authored by weichinweng's avatar weichinweng Committed by Weichin Weng
Browse files

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
parent c8ec673f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -797,7 +797,8 @@ public class BluetoothKeystoreService {
        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();