otter: gps/location: Convert remaining Android.mk to bp

Change-Id: I75e6af92795fe755a48557aa06106406b14c6750
diff --git a/BoardConfig.mk b/BoardConfig.mk
index c26cd09..4aba399 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -63,7 +63,6 @@
 
 # GPS
 BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := default
-LOC_HIDL_VERSION := 4.3
 
 # HIDL
 DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
diff --git a/gps/Android.mk b/gps/Android.mk
deleted file mode 100644
index 31841c4..0000000
--- a/gps/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
-
-# Set required flags
-GNSS_CFLAGS := \
-    -Werror \
-    -Wno-undefined-bool-conversion
-
-GNSS_HIDL_VERSION = 2.1
-
-GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8937
-GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8953
-GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8998
-GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += apq8098_latv
-GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm710
-GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += qcs605
-GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm845
-GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm660
-
-ifneq (,$(filter $(GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
-GNSS_HIDL_LEGACY_MEASURMENTS = true
-endif
-
-LOCAL_PATH := $(call my-dir)
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
-endif # ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
diff --git a/gps/android/2.1/Android.bp b/gps/android/2.1/Android.bp
new file mode 100644
index 0000000..f35b68a
--- /dev/null
+++ b/gps/android/2.1/Android.bp
@@ -0,0 +1,96 @@
+cc_library_shared {
+    name: "android.hardware.gnss@2.1-impl-qti",
+    vendor: true,
+    relative_install_path: "hw",
+    srcs: [
+        "AGnss.cpp",
+        "Gnss.cpp",
+        "AGnssRil.cpp",
+        "GnssMeasurement.cpp",
+        "GnssConfiguration.cpp",
+        "GnssBatching.cpp",
+        "GnssGeofencing.cpp",
+        "GnssNi.cpp",
+        "GnssDebug.cpp",
+        "GnssAntennaInfo.cpp",
+        "MeasurementCorrections.cpp",
+        "GnssVisibilityControl.cpp",
+    ] + [
+        "location_api/GnssAPIClient.cpp",
+        "location_api/MeasurementAPIClient.cpp",
+        "location_api/GeofenceAPIClient.cpp",
+        "location_api/BatchingAPIClient.cpp",
+        "location_api/LocationUtil.cpp",
+    ],
+
+    local_include_dirs: ["location_api"],
+
+    header_libs: [
+        "libgps.utils_headers",
+        "libloc_core_headers",
+        "libloc_pla_headers",
+        "liblocation_api_headers",
+        "liblocbatterylistener_headers",
+    ],
+
+    shared_libs: [
+        "liblog",
+        "libhidlbase",
+        "libcutils",
+        "libutils",
+        "android.hardware.gnss@1.0",
+        "android.hardware.gnss@1.1",
+        "android.hardware.gnss@2.0",
+        "android.hardware.gnss@2.1",
+        "android.hardware.gnss.measurement_corrections@1.0",
+        "android.hardware.gnss.measurement_corrections@1.1",
+        "android.hardware.gnss.visibility_control@1.0",
+        "android.hardware.health@1.0",
+        "android.hardware.health@2.0",
+        "android.hardware.health@2.1",
+        "android.hardware.power@1.2",
+        "libbase",
+    ] + [
+        "libloc_core",
+        "libgps.utils",
+        "libdl",
+        "liblocation_api",
+    ],
+
+    cflags: GNSS_CFLAGS,
+    static_libs: ["liblocbatterylistener"] + ["libhealthhalutils"],
+}
+
+cc_binary {
+    name: "android.hardware.gnss@2.1-service-qti",
+    vintf_fragments: ["android.hardware.gnss@2.1-service-qti.xml"],
+    vendor: true,
+    relative_install_path: "hw",
+    init_rc: ["android.hardware.gnss@2.1-service-qti.rc"],
+    srcs: ["service.cpp"],
+
+    header_libs: [
+        "libgps.utils_headers",
+        "libloc_core_headers",
+        "libloc_pla_headers",
+        "liblocation_api_headers",
+    ],
+
+    shared_libs: [
+        "liblog",
+        "libcutils",
+        "libdl",
+        "libbase",
+        "libutils",
+        "libgps.utils",
+        "libqti_vndfwk_detect",
+    ] + [
+        "libhidlbase",
+        "android.hardware.gnss@1.0",
+        "android.hardware.gnss@1.1",
+        "android.hardware.gnss@2.0",
+        "android.hardware.gnss@2.1",
+    ],
+
+    cflags: GNSS_CFLAGS + ["-DLOC_HIDL_VERSION=\"4.3\""],
+}
diff --git a/gps/android/2.1/Android.mk b/gps/android/2.1/Android.mk
deleted file mode 100644
index 0d1af7a..0000000
--- a/gps/android/2.1/Android.mk
+++ /dev/null
@@ -1,111 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gnss@2.1-impl-qti
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
-    AGnss.cpp \
-    Gnss.cpp \
-    AGnssRil.cpp \
-    GnssMeasurement.cpp \
-    GnssConfiguration.cpp \
-    GnssBatching.cpp \
-    GnssGeofencing.cpp \
-    GnssNi.cpp \
-    GnssDebug.cpp \
-    GnssAntennaInfo.cpp \
-    MeasurementCorrections.cpp \
-    GnssVisibilityControl.cpp
-
-LOCAL_SRC_FILES += \
-    location_api/GnssAPIClient.cpp \
-    location_api/MeasurementAPIClient.cpp \
-    location_api/GeofenceAPIClient.cpp \
-    location_api/BatchingAPIClient.cpp \
-    location_api/LocationUtil.cpp \
-
-ifeq ($(GNSS_HIDL_LEGACY_MEASURMENTS),true)
-LOCAL_CFLAGS += \
-     -DGNSS_HIDL_LEGACY_MEASURMENTS
-endif
-
-LOCAL_C_INCLUDES:= \
-    $(LOCAL_PATH)/location_api
-
-LOCAL_HEADER_LIBRARIES := \
-    libgps.utils_headers \
-    libloc_core_headers \
-    libloc_pla_headers \
-    liblocation_api_headers \
-    liblocbatterylistener_headers
-
-LOCAL_SHARED_LIBRARIES := \
-    liblog \
-    libhidlbase \
-    libcutils \
-    libutils \
-    android.hardware.gnss@1.0 \
-    android.hardware.gnss@1.1 \
-    android.hardware.gnss@2.0 \
-    android.hardware.gnss@2.1 \
-    android.hardware.gnss.measurement_corrections@1.0 \
-    android.hardware.gnss.measurement_corrections@1.1 \
-    android.hardware.gnss.visibility_control@1.0 \
-    android.hardware.health@1.0 \
-    android.hardware.health@2.0 \
-    android.hardware.health@2.1 \
-    android.hardware.power@1.2 \
-    libbase
-
-LOCAL_SHARED_LIBRARIES += \
-    libloc_core \
-    libgps.utils \
-    libdl \
-    liblocation_api \
-
-LOCAL_CFLAGS += $(GNSS_CFLAGS)
-LOCAL_STATIC_LIBRARIES := liblocbatterylistener
-LOCAL_STATIC_LIBRARIES += libhealthhalutils
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gnss@2.1-service-qti
-
-LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@2.1-service-qti.xml
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_INIT_RC := android.hardware.gnss@2.1-service-qti.rc
-LOCAL_SRC_FILES := \
-    service.cpp \
-
-LOCAL_HEADER_LIBRARIES := \
-    libgps.utils_headers \
-    libloc_core_headers \
-    libloc_pla_headers \
-    liblocation_api_headers
-
-
-LOCAL_SHARED_LIBRARIES := \
-    liblog \
-    libcutils \
-    libdl \
-    libbase \
-    libutils \
-    libgps.utils \
-    libqti_vndfwk_detect \
-
-LOCAL_SHARED_LIBRARIES += \
-    libhidlbase \
-    android.hardware.gnss@1.0 \
-    android.hardware.gnss@1.1 \
-    android.hardware.gnss@2.0 \
-    android.hardware.gnss@2.1 \
-
-LOCAL_CFLAGS += $(GNSS_CFLAGS)
-
-ifneq ($(LOC_HIDL_VERSION),)
-LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
-endif
-
-include $(BUILD_EXECUTABLE)
diff --git a/gps/android/Android.mk b/gps/android/Android.mk
deleted file mode 100644
index aa2f4b5..0000000
--- a/gps/android/Android.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(call all-subdir-makefiles)
diff --git a/gps/android/utils/Android.bp b/gps/android/utils/Android.bp
index 20fea88..2609c97 100644
--- a/gps/android/utils/Android.bp
+++ b/gps/android/utils/Android.bp
@@ -33,5 +33,6 @@
 cc_library_headers {
 
     name: "liblocbatterylistener_headers",
+    vendor: true,
     export_include_dirs: ["."],
 }
diff --git a/location/Android.mk b/location/Android.mk
deleted file mode 100644
index 888404c..0000000
--- a/location/Android.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
diff --git a/location/utils/Android.mk b/location/utils/Android.mk
deleted file mode 100644
index 6361f9b..0000000
--- a/location/utils/Android.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/location/utils/loc_socket/Android.bp b/location/utils/loc_socket/Android.bp
new file mode 100644
index 0000000..459b729
--- /dev/null
+++ b/location/utils/loc_socket/Android.bp
@@ -0,0 +1,25 @@
+cc_library_shared {
+    name: "libloc_socket",
+    vendor: true,
+
+    shared_libs: [
+        "libutils",
+        "libcutils",
+        "liblog",
+        "libgps.utils",
+    ],
+
+    srcs: ["LocSocket.cpp"],
+
+    cflags: [
+        "-fno-short-enums",
+        "-D_ANDROID_",
+    ] + GNSS_CFLAGS,
+
+    header_libs: [
+        "libloc_core_headers",
+        "libgps.utils_headers",
+        "libloc_pla_headers",
+        "liblocation_api_headers",
+    ],
+}
diff --git a/location/utils/loc_socket/Android.mk b/location/utils/loc_socket/Android.mk
deleted file mode 100644
index f2972eb..0000000
--- a/location/utils/loc_socket/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libloc_socket
-LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := \
-    libutils \
-    libcutils \
-    liblog \
-    libgps.utils
-
-LOCAL_SRC_FILES := \
-    LocSocket.cpp
-
-LOCAL_CFLAGS := \
-    -fno-short-enums \
-    -D_ANDROID_
-
-## Includes
-LOCAL_C_INCLUDES := \
-    $(TARGET_OUT_HEADERS)/qmi-framework/inc \
-    $(TARGET_OUT_HEADERS)/qmi/inc
-LOCAL_HEADER_LIBRARIES := \
-    libloc_core_headers \
-    libgps.utils_headers \
-    libloc_pla_headers \
-    liblocation_api_headers
-LOCAL_CFLAGS += $(GNSS_CFLAGS)
-
-ifeq ($(TARGET_KERNEL_VERSION),$(filter $(TARGET_KERNEL_VERSION),3.18 4.4 4.9))
-LOCAL_CFLAGS += -DUSE_QSOCKET
-LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/qsocket/inc
-LOCAL_SHARED_LIBRARIES += libqsocket
-endif
-
-include $(BUILD_SHARED_LIBRARY)