aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Delwiche <delwiche@google.com>2024-11-14 00:35:48 +0000
committeraoleary <seanm187@gmail.com>2025-02-21 09:44:51 +0000
commit2c11b40726d8ad86e7e5c010d4d6834a2b447099 (patch)
tree97f9268ee3b0cfe0f741b3f2e2c012f19718ffee
parent5a9f302d26d4fc3d6cc18c2456c550cb4464009e (diff)
Reset permissions for not bonded device
According to the PBAP specification, The PSE user shall have to confirm at least the first Phone Book Access Profile connection from each new PCE. According to the MAP specification, The MCE and MSE shall be bonded before setting up a Message Access Profile connection. Let's remove the permissions when the device is unbonded. This is a backport of change ag/30386015 but requires minor changes to logic. Flag: EXEMPT, security fix Bug: 289375038 Bug: 289811388 Test: atest BluetoothInstrumentationTests Ignore-AOSP-First: security fix (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8507ce69bb6e4e508a82cfc41dce56be1450a62e) Merged-In: I8b9b29310db2d14e5dfaddc81a682366fbef42d3 Change-Id: I8b9b29310db2d14e5dfaddc81a682366fbef42d3
-rw-r--r--android/app/src/com/android/bluetooth/btservice/BondStateMachine.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/android/app/src/com/android/bluetooth/btservice/BondStateMachine.java b/android/app/src/com/android/bluetooth/btservice/BondStateMachine.java
index c6633daab2..d765a8012e 100644
--- a/android/app/src/com/android/bluetooth/btservice/BondStateMachine.java
+++ b/android/app/src/com/android/bluetooth/btservice/BondStateMachine.java
@@ -463,6 +463,13 @@ final class BondStateMachine extends StateMachine {
}
}
+ if (newState == BluetoothDevice.BOND_NONE) {
+ // Remove the permissions for unbonded devices
+ mAdapterService.setMessageAccessPermission(device, BluetoothDevice.ACCESS_UNKNOWN);
+ mAdapterService.setPhonebookAccessPermission(device, BluetoothDevice.ACCESS_UNKNOWN);
+ mAdapterService.setSimAccessPermission(device, BluetoothDevice.ACCESS_UNKNOWN);
+ }
+
Intent intent = new Intent(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
intent.putExtra(BluetoothDevice.EXTRA_BOND_STATE, newState);