Disallow BT headset pairing for DPM mode 29/122129/1 accepted/tizen/3.0/ivi/20170403.021649 accepted/tizen/3.0/mobile/20170403.021445 accepted/tizen/3.0/tv/20170403.021600 accepted/tizen/3.0/wearable/20170403.021627 submit/tizen_3.0/20170330.083350
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 30 Mar 2017 08:26:32 +0000 (17:26 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 30 Mar 2017 08:26:32 +0000 (17:26 +0900)
Change-Id: I0e759fb6ba1e51ababe368f0b20a7f2dab9d4178
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-service/bt-service-device.c

index 004ca7a..fc9bb95 100644 (file)
 #include "bt-service-gap-agent.h"
 #include "bt-service-pbap.h"
 
+#ifdef TIZEN_FEATURE_BT_DPM
+#include "bt-service-dpm.h"
+#endif
+
 #define BT_SYSPOPUP_IPC_RESPONSE_OBJECT "/org/projectx/bt_syspopup_res"
 #define BT_SYSPOPUP_INTERFACE "User.Bluetooth.syspopup"
 #define BT_SYSPOPUP_METHOD_RESPONSE "Response"
@@ -944,6 +948,16 @@ int _bt_bond_device(int request_id,
 
        BT_CHECK_PARAMETER(device_address, return);
 
+#ifdef TIZEN_FEATURE_BT_DPM
+       int pairing_state = DPM_STATUS_ERROR;
+
+       _bt_dpm_get_bluetooth_pairing_state(&pairing_state);
+       if (pairing_state == DPM_RESTRICTED) {
+               BT_ERR("Not allow to pair the device");
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
+       }
+#endif
+
        if (bonding_info) {
                BT_ERR("Bonding in progress");