Loading android/app/src/com/android/bluetooth/map/BluetoothMapService.java +17 −0 Original line number Diff line number Diff line Loading @@ -588,6 +588,20 @@ public class BluetoothMapService extends ProfileService { } } /** * Set connection policy of the profile and tries to disconnect it if connectionPolicy is * {@link BluetoothProfile#CONNECTION_POLICY_FORBIDDEN} * * <p> The device should already be paired. * Connection policy can be one of: * {@link BluetoothProfile#CONNECTION_POLICY_ALLOWED}, * {@link BluetoothProfile#CONNECTION_POLICY_FORBIDDEN}, * {@link BluetoothProfile#CONNECTION_POLICY_UNKNOWN} * * @param device Paired bluetooth device * @param connectionPolicy is the connection policy to set to for this profile * @return true if connectionPolicy is set, false on error */ boolean setConnectionPolicy(BluetoothDevice device, int connectionPolicy) { enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); Loading @@ -596,6 +610,9 @@ public class BluetoothMapService extends ProfileService { } AdapterService.getAdapterService().getDatabase() .setProfileConnectionPolicy(device, BluetoothProfile.MAP, connectionPolicy); if (connectionPolicy == BluetoothProfile.CONNECTION_POLICY_FORBIDDEN) { disconnect(device); } return true; } Loading Loading
android/app/src/com/android/bluetooth/map/BluetoothMapService.java +17 −0 Original line number Diff line number Diff line Loading @@ -588,6 +588,20 @@ public class BluetoothMapService extends ProfileService { } } /** * Set connection policy of the profile and tries to disconnect it if connectionPolicy is * {@link BluetoothProfile#CONNECTION_POLICY_FORBIDDEN} * * <p> The device should already be paired. * Connection policy can be one of: * {@link BluetoothProfile#CONNECTION_POLICY_ALLOWED}, * {@link BluetoothProfile#CONNECTION_POLICY_FORBIDDEN}, * {@link BluetoothProfile#CONNECTION_POLICY_UNKNOWN} * * @param device Paired bluetooth device * @param connectionPolicy is the connection policy to set to for this profile * @return true if connectionPolicy is set, false on error */ boolean setConnectionPolicy(BluetoothDevice device, int connectionPolicy) { enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); Loading @@ -596,6 +610,9 @@ public class BluetoothMapService extends ProfileService { } AdapterService.getAdapterService().getDatabase() .setProfileConnectionPolicy(device, BluetoothProfile.MAP, connectionPolicy); if (connectionPolicy == BluetoothProfile.CONNECTION_POLICY_FORBIDDEN) { disconnect(device); } return true; } Loading