From c32ff77c5b3ed8a82f02edbfda716deac6433785 Mon Sep 17 00:00:00 2001 From: "h.sandeep" Date: Thu, 12 May 2016 12:02:57 +0530 Subject: [PATCH] DPM: Modify Discoverable policy handling. Change-Id: I26df964a4203ede38c4dcad1e513ff144b058bb5 Signed-off-by: h.sandeep --- bt-service/bt-service-dpm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bt-service/bt-service-dpm.c b/bt-service/bt-service-dpm.c index e45c128..63c4891 100644 --- a/bt-service/bt-service-dpm.c +++ b/bt-service/bt-service-dpm.c @@ -28,6 +28,7 @@ #include "bt-internal-types.h" #include "bt-service-common.h" +#include "bt-service-adapter.h" #include "bt-service-dpm.h" static dpm_policy_t policy_table[DPM_POLICY_END] = { @@ -522,6 +523,11 @@ dpm_status_t _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value) if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED) return DPM_RESTRICTED; + if (value == DPM_RESTRICTED) { + /* Since Discoverable mode is restricted, stop the ongoing discoverable mode */ + _bt_set_discoverable_mode(BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, 0); + } + policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value = value; return DPM_RESULT_SUCCESS; @@ -544,6 +550,11 @@ dpm_status_t _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED) return DPM_RESTRICTED; + if (value == DPM_RESTRICTED) { + /* Since Discoverable mode is restricted, stop the ongoing discoverable mode */ + _bt_set_discoverable_mode(BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, 0); + } + policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value = value; return DPM_RESULT_SUCCESS; -- 2.7.4