Merge "A2DP role change: framework API." into tizen
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-agent.c
index 82e18d1..3457d77 100644 (file)
@@ -642,13 +642,16 @@ fail:
                request_type = BT_AGENT_EVENT_MAP_REQUEST;
        /* TODO: MAP is already here */
 
-       if (trust) {
-               BT_INFO("Trusted device, so authorize\n");
+       if (trust || !headed_plugin_info->plugin_headed_enabled) {
+               BT_INFO("Trusted or Headless device, so authorize\n");
                gap_agent_reply_authorize(agent,
                                GAP_AGENT_ACCEPT, NULL);
-       } else {
-               if (headed_plugin_info->plugin_headed_enabled)
-                       headed_plugin_info->headed_plugin->bt_launch_system_popup(request_type, name, auth_info, NULL, NULL,
+
+               goto done;
+       }
+
+       if (headed_plugin_info->plugin_headed_enabled) {
+               headed_plugin_info->headed_plugin->bt_launch_system_popup(request_type, name, auth_info, NULL, NULL,
                                        _gap_agent_get_path(agent));
        }