Fix uipc.c to never pass -1 to FD_ISSET.

The behavior of FD_ISSET when passed -1 is undefined.

I checked all calls of FD_SET and FD_CLR in this file, and they all
seem to be correctly guarded. None of the FD_ISSET calls were, so I
added a SAFE_FD_ISSET macro to return false when passed -1, which is
presumably what the callers intended.

This allows Bluetooth to be enabled on a device where the C library
aborts if passed any out of range fd.

Bug: 11047121
Change-Id: I261404a5a80884d5e9edab8beb3c93969113dc76
Fix BT failed to enable issue.

When BT startup, bt_hc_worker thread will send BT_EVT_PRELOAD_CMPL
to btu_task. However in bte_main_enable, it first calls
bte_hci_enable(), then creates btu_task. So it may send BT_EVT_PRELOAD_CMPL
before btu_task created. Change creating btu_task before call bte_hci_enable
to make sure btu_task already created successfully before send
BT_EVT_PRELOAD_CMPL

Change-Id: I2a784234e0fcf3a95743978f2a8c60aa30fd83be
Author: Tan Jingjing <jjtan@marvell.com>
Signed-off-by: yuwan@marvell.com <yuwang19860130@gmail.com>
Fix bug in PAN code where no new PAN connections can be made.

If you call PAN_connect() followed quickly by PAN_disconnect(),
you won't be able to establish any additional PANU connections.
This happens because the connection never has a chance to make
it into PAN_STATE_CONNECTED and num_conns only gets decremented
if you disconnect in the connected state. As a result, subsequent
calls to connect will fail because the stack still believes there
to be an existing connection.

Change-Id: Id24873828ca4f517496cb19a44993d0e8e837a1e