Merge "hikey: Add HIKEY_USE_LEGACY_TI_BLUETOOTH build option to transition to common bluetooth HAL"
diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk
index bbcb0d8..ff7e9cf 100644
--- a/BoardConfigCommon.mk
+++ b/BoardConfigCommon.mk
@@ -36,6 +36,7 @@
 TARGET_USE_PAN_DISPLAY := true
 
 BOARD_SEPOLICY_DIRS += device/linaro/hikey/sepolicy
+BOARD_SEPOLICY_DIRS += system/bt/vendor_libs/linux/sepolicy
 
 ifeq ($(HOST_OS), linux)
 ifeq ($(TARGET_SYSTEMIMAGES_USE_SQUASHFS), true)
diff --git a/device-common.mk b/device-common.mk
index d4aa0da..a826636 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -21,7 +21,7 @@
 DEVICE_PACKAGE_OVERLAYS := device/linaro/hikey/overlay
 
 # Add openssh support for remote debugging and job submission
-PRODUCT_PACKAGES += ssh sftp scp sshd ssh-keygen sshd_config start-ssh uim
+PRODUCT_PACKAGES += ssh sftp scp sshd ssh-keygen sshd_config start-ssh
 
 # Add wifi-related packages
 PRODUCT_PACKAGES += libwpa_client wpa_supplicant hostapd wificond wifilogd
@@ -41,7 +41,6 @@
 PRODUCT_PACKAGES += \
     android.hardware.audio@2.0-impl \
     android.hardware.audio.effect@2.0-impl \
-    android.hardware.bluetooth@1.0-service.hikey \
     android.hardware.broadcastradio@1.0-impl \
     android.hardware.soundtrigger@2.0-impl
 
@@ -55,6 +54,13 @@
 			wl18xx-fw-4.bin \
 			wl18xx-conf.bin
 
+
+ifeq ($(HIKEY_USE_LEGACY_TI_BLUETOOTH), true)
+PRODUCT_PACKAGES += android.hardware.bluetooth@1.0-service.hikey uim
+else
+PRODUCT_PACKAGES += android.hardware.bluetooth@1.0-service.btlinux
+endif
+
 # PowerHAL
 PRODUCT_PACKAGES += android.hardware.power@1.0-impl
 
diff --git a/hikey.mk b/hikey.mk
index 3174ba4..779ee87 100644
--- a/hikey.mk
+++ b/hikey.mk
@@ -3,10 +3,17 @@
 endif
 TARGET_PREBUILT_KERNEL := device/linaro/hikey-kernel/Image-dtb-$(TARGET_KERNEL_USE)
 TARGET_PREBUILT_DTB := device/linaro/hikey-kernel/hi6220-hikey.dtb-$(TARGET_KERNEL_USE)
+
 ifeq ($(TARGET_KERNEL_USE), 3.18)
-TARGET_FSTAB := fstab.hikey-$(TARGET_KERNEL_USE)
+  TARGET_FSTAB := fstab.hikey-$(TARGET_KERNEL_USE)
+  HIKEY_USE_LEGACY_TI_BLUETOOTH := true
 else
-TARGET_FSTAB := fstab.hikey
+  ifeq ($(TARGET_KERNEL_USE), 4.4)
+    HIKEY_USE_LEGACY_TI_BLUETOOTH := true
+  else
+    HIKEY_USE_LEGACY_TI_BLUETOOTH := false
+  endif
+  TARGET_FSTAB := fstab.hikey
 endif
 
 #
diff --git a/hikey960.mk b/hikey960.mk
index 90d8784..986048f 100644
--- a/hikey960.mk
+++ b/hikey960.mk
@@ -1,3 +1,5 @@
+HIKEY_USE_LEGACY_TI_BLUETOOTH := true
+
 #
 # Inherit the full_base and device configurations
 $(call inherit-product, device/linaro/hikey/hikey960/device-hikey960.mk)