Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +5 −4 Original line number Diff line number Diff line Loading @@ -820,10 +820,6 @@ public class AdapterService extends Service { mSdpManager = null; } if (mBluetoothKeystoreService != null) { mBluetoothKeystoreService.cleanup(); } if (mActivityAttributionService != null) { mActivityAttributionService.cleanup(); } Loading @@ -842,6 +838,11 @@ public class AdapterService extends Service { mJniCallbacks.cleanup(); } if (mBluetoothKeystoreService != null) { debugLog("cleanup(): mBluetoothKeystoreService.cleanup()"); mBluetoothKeystoreService.cleanup(); } if (mPhonePolicy != null) { mPhonePolicy.cleanup(); } Loading android/app/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java +4 −25 Original line number Diff line number Diff line Loading @@ -192,7 +192,6 @@ public class BluetoothKeystoreService { debugLog("cleanup() called before start()"); return; } // Mark service as stopped setBluetoothKeystoreService(null); Loading @@ -213,7 +212,6 @@ public class BluetoothKeystoreService { @VisibleForTesting public void cleanupForCommonCriteriaModeEnable() { try { Thread.sleep(100); setEncryptKeyOrRemoveKey(CONFIG_FILE_PREFIX, CONFIG_FILE_HASH); } catch (InterruptedException e) { reportBluetoothKeystoreException(e, "Interrupted while operating."); Loading Loading @@ -362,16 +360,10 @@ public class BluetoothKeystoreService { if (decryptedString.isEmpty()) { cleanupAll(); } else if (decryptedString.equals(CONFIG_FILE_HASH)) { backupConfigEncryptionFile(); readHashFile(CONFIG_FILE_PATH, CONFIG_FILE_PREFIX); //save Map if (mNameDecryptKey.containsKey(CONFIG_FILE_PREFIX) && mNameDecryptKey.get(CONFIG_FILE_PREFIX).equals( mNameDecryptKey.get(CONFIG_BACKUP_PREFIX))) { infoLog("Since the hash is same with previous, don't need encrypt again."); } else { mPendingEncryptKey.put(prefixString); } mPendingEncryptKey.put(CONFIG_FILE_PREFIX); readHashFile(CONFIG_BACKUP_PATH, CONFIG_BACKUP_PREFIX); mPendingEncryptKey.put(CONFIG_BACKUP_PREFIX); saveEncryptedKey(); } return; Loading Loading @@ -474,6 +466,7 @@ public class BluetoothKeystoreService { } if (!keyEncryptedLines.isEmpty()) { Files.write(Paths.get(CONFIG_FILE_ENCRYPTION_PATH), keyEncryptedLines); Files.write(Paths.get(CONFIG_BACKUP_ENCRYPTION_PATH), keyEncryptedLines); } } catch (IOException e) { throw new RuntimeException("write encryption file fail"); Loading Loading @@ -503,20 +496,6 @@ public class BluetoothKeystoreService { return mNameDecryptKey; } private void backupConfigEncryptionFile() throws IOException { if (Files.exists(Paths.get(CONFIG_FILE_ENCRYPTION_PATH))) { Files.move(Paths.get(CONFIG_FILE_ENCRYPTION_PATH), Paths.get(CONFIG_BACKUP_ENCRYPTION_PATH), StandardCopyOption.REPLACE_EXISTING); } if (mNameEncryptKey.containsKey(CONFIG_FILE_PREFIX)) { mNameEncryptKey.put(CONFIG_BACKUP_PREFIX, mNameEncryptKey.get(CONFIG_FILE_PREFIX)); } if (mNameDecryptKey.containsKey(CONFIG_FILE_PREFIX)) { mNameDecryptKey.put(CONFIG_BACKUP_PREFIX, mNameDecryptKey.get(CONFIG_FILE_PREFIX)); } } private boolean doesComparePass(int item) { return (mCompareResult & item) == item; } Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +5 −4 Original line number Diff line number Diff line Loading @@ -820,10 +820,6 @@ public class AdapterService extends Service { mSdpManager = null; } if (mBluetoothKeystoreService != null) { mBluetoothKeystoreService.cleanup(); } if (mActivityAttributionService != null) { mActivityAttributionService.cleanup(); } Loading @@ -842,6 +838,11 @@ public class AdapterService extends Service { mJniCallbacks.cleanup(); } if (mBluetoothKeystoreService != null) { debugLog("cleanup(): mBluetoothKeystoreService.cleanup()"); mBluetoothKeystoreService.cleanup(); } if (mPhonePolicy != null) { mPhonePolicy.cleanup(); } Loading
android/app/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreService.java +4 −25 Original line number Diff line number Diff line Loading @@ -192,7 +192,6 @@ public class BluetoothKeystoreService { debugLog("cleanup() called before start()"); return; } // Mark service as stopped setBluetoothKeystoreService(null); Loading @@ -213,7 +212,6 @@ public class BluetoothKeystoreService { @VisibleForTesting public void cleanupForCommonCriteriaModeEnable() { try { Thread.sleep(100); setEncryptKeyOrRemoveKey(CONFIG_FILE_PREFIX, CONFIG_FILE_HASH); } catch (InterruptedException e) { reportBluetoothKeystoreException(e, "Interrupted while operating."); Loading Loading @@ -362,16 +360,10 @@ public class BluetoothKeystoreService { if (decryptedString.isEmpty()) { cleanupAll(); } else if (decryptedString.equals(CONFIG_FILE_HASH)) { backupConfigEncryptionFile(); readHashFile(CONFIG_FILE_PATH, CONFIG_FILE_PREFIX); //save Map if (mNameDecryptKey.containsKey(CONFIG_FILE_PREFIX) && mNameDecryptKey.get(CONFIG_FILE_PREFIX).equals( mNameDecryptKey.get(CONFIG_BACKUP_PREFIX))) { infoLog("Since the hash is same with previous, don't need encrypt again."); } else { mPendingEncryptKey.put(prefixString); } mPendingEncryptKey.put(CONFIG_FILE_PREFIX); readHashFile(CONFIG_BACKUP_PATH, CONFIG_BACKUP_PREFIX); mPendingEncryptKey.put(CONFIG_BACKUP_PREFIX); saveEncryptedKey(); } return; Loading Loading @@ -474,6 +466,7 @@ public class BluetoothKeystoreService { } if (!keyEncryptedLines.isEmpty()) { Files.write(Paths.get(CONFIG_FILE_ENCRYPTION_PATH), keyEncryptedLines); Files.write(Paths.get(CONFIG_BACKUP_ENCRYPTION_PATH), keyEncryptedLines); } } catch (IOException e) { throw new RuntimeException("write encryption file fail"); Loading Loading @@ -503,20 +496,6 @@ public class BluetoothKeystoreService { return mNameDecryptKey; } private void backupConfigEncryptionFile() throws IOException { if (Files.exists(Paths.get(CONFIG_FILE_ENCRYPTION_PATH))) { Files.move(Paths.get(CONFIG_FILE_ENCRYPTION_PATH), Paths.get(CONFIG_BACKUP_ENCRYPTION_PATH), StandardCopyOption.REPLACE_EXISTING); } if (mNameEncryptKey.containsKey(CONFIG_FILE_PREFIX)) { mNameEncryptKey.put(CONFIG_BACKUP_PREFIX, mNameEncryptKey.get(CONFIG_FILE_PREFIX)); } if (mNameDecryptKey.containsKey(CONFIG_FILE_PREFIX)) { mNameDecryptKey.put(CONFIG_BACKUP_PREFIX, mNameDecryptKey.get(CONFIG_FILE_PREFIX)); } } private boolean doesComparePass(int item) { return (mCompareResult & item) == item; } Loading