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 array shifting logic of updating bg devices list.

Assume there're bg devices [a, b, c], and a is removing. The code updates the
array to [b, c, c], which the right most remained element of bg_dev_list is not
cleared after shifting and makes it duplicated.

Change-Id: I048f6526a5de32aa82ef0eb22df7d5f8b937171b
Signed-off-by: Ting-Yu Chou <janus926@gmail.com>
Merge branch 'kk4.4' of https://github.com/SlimRoms/android_external_bluetooth_bluedroid into kk4.4