Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +1 −0 Original line number Diff line number Diff line Loading @@ -2700,6 +2700,7 @@ public class AdapterService extends Service { } service.logUserBondResponse(device, false, source); service.mBondAttemptCallerInfo.remove(device.getAddress()); service.mPhonePolicy.onRemoveBondRequest(device); deviceProp.setBondingInitiatedLocally(false); Message msg = service.mBondStateMachine.obtainMessage(BondStateMachine.REMOVE_BOND); Loading android/app/src/com/android/bluetooth/btservice/PhonePolicy.java +26 −0 Original line number Diff line number Diff line Loading @@ -1148,6 +1148,32 @@ public class PhonePolicy implements AdapterService.BluetoothStateCallback { } } /** * Resets the service connection policies for the device. This is called when the {@link * BluetoothDevice#removeBond} is requested for the device. * * @param device is the remote device whose services have been discovered */ void onRemoveBondRequest(BluetoothDevice device) { if (!Flags.preventServiceConnectionsOnRemoveBond()) { return; } debugLog("onRemoveBondRequest: Disabling all profiles for " + device); // Don't allow any profiles to connect to the device. for (int profileId = BluetoothProfile.HEADSET; profileId < BluetoothProfile.MAX_PROFILE_ID; profileId++) { if (mAdapterService.getDatabase().getProfileConnectionPolicy(device, profileId) == BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mAdapterService .getDatabase() .setProfileConnectionPolicy( device, profileId, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); } } } private static void debugLog(String msg) { Log.d(TAG, msg); } Loading android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java +0 −1 Original line number Diff line number Diff line Loading @@ -349,7 +349,6 @@ public class DatabaseManager { * BluetoothProfile.CONNECTION_POLICY_FORBIDDEN}, {@link * BluetoothProfile.CONNECTION_POLICY_ALLOWED} */ @VisibleForTesting public boolean setProfileConnectionPolicy( BluetoothDevice device, int profile, int newConnectionPolicy) { if (device == null) { Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +1 −0 Original line number Diff line number Diff line Loading @@ -2700,6 +2700,7 @@ public class AdapterService extends Service { } service.logUserBondResponse(device, false, source); service.mBondAttemptCallerInfo.remove(device.getAddress()); service.mPhonePolicy.onRemoveBondRequest(device); deviceProp.setBondingInitiatedLocally(false); Message msg = service.mBondStateMachine.obtainMessage(BondStateMachine.REMOVE_BOND); Loading
android/app/src/com/android/bluetooth/btservice/PhonePolicy.java +26 −0 Original line number Diff line number Diff line Loading @@ -1148,6 +1148,32 @@ public class PhonePolicy implements AdapterService.BluetoothStateCallback { } } /** * Resets the service connection policies for the device. This is called when the {@link * BluetoothDevice#removeBond} is requested for the device. * * @param device is the remote device whose services have been discovered */ void onRemoveBondRequest(BluetoothDevice device) { if (!Flags.preventServiceConnectionsOnRemoveBond()) { return; } debugLog("onRemoveBondRequest: Disabling all profiles for " + device); // Don't allow any profiles to connect to the device. for (int profileId = BluetoothProfile.HEADSET; profileId < BluetoothProfile.MAX_PROFILE_ID; profileId++) { if (mAdapterService.getDatabase().getProfileConnectionPolicy(device, profileId) == BluetoothProfile.CONNECTION_POLICY_ALLOWED) { mAdapterService .getDatabase() .setProfileConnectionPolicy( device, profileId, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); } } } private static void debugLog(String msg) { Log.d(TAG, msg); } Loading
android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java +0 −1 Original line number Diff line number Diff line Loading @@ -349,7 +349,6 @@ public class DatabaseManager { * BluetoothProfile.CONNECTION_POLICY_FORBIDDEN}, {@link * BluetoothProfile.CONNECTION_POLICY_ALLOWED} */ @VisibleForTesting public boolean setProfileConnectionPolicy( BluetoothDevice device, int profile, int newConnectionPolicy) { if (device == null) { Loading