samsung: Make HAL header paths configurable through soong

$(call soong_config_set,samsungVars,target_specific_header_path,$(DEVICE_PATH)/include)

Change-Id: Ibdfd255efafd471e59dfec0860ace40c21a6e27f
diff --git a/Android.bp b/Android.bp
index f4fc009..869896a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -4,3 +4,20 @@
         "hardware/google/interfaces",
     ],
 }
+
+soong_config_module_type {
+    name: "samsung_header_path",
+    module_type: "cc_defaults",
+    config_namespace: "samsungVars",
+    value_variables: ["target_specific_header_path"],
+    properties: ["include_dirs"],
+}
+
+samsung_header_path {
+    name: "samsung_header_path_defaults",
+    soong_config_variables: {
+        target_specific_header_path: {
+            include_dirs: ["%s"],
+        },
+    },
+}
diff --git a/aidl/light/Android.bp b/aidl/light/Android.bp
index ec2a10a..6595fad 100644
--- a/aidl/light/Android.bp
+++ b/aidl/light/Android.bp
@@ -1,15 +1,15 @@
 //
-// Copyright (C) 2021 The LineageOS Project
+// Copyright (C) 2021-2024 The LineageOS Project
 //
 // SPDX-License-Identifier: Apache-2.0
 //
 
 cc_binary {
     name: "android.hardware.light-service.samsung",
+    defaults: ["samsung_header_path_defaults"],
     relative_install_path: "hw",
     init_rc: ["android.hardware.light-service.samsung.rc"],
     vintf_fragments: ["android.hardware.light-service.samsung.xml"],
-    local_include_dirs: ["include"],
     srcs: [
         "Lights.cpp",
         "service.cpp",
diff --git a/aidl/light/Lights.h b/aidl/light/Lights.h
index 253167b..a45c270 100644
--- a/aidl/light/Lights.h
+++ b/aidl/light/Lights.h
@@ -7,8 +7,9 @@
 #pragma once
 
 #include <aidl/android/hardware/light/BnLights.h>
+#include <samsung_lights.h>
+
 #include <unordered_map>
-#include "samsung_lights.h"
 
 using ::aidl::android::hardware::light::HwLightState;
 using ::aidl::android::hardware::light::HwLight;
diff --git a/aidl/light/include/samsung_lights.h b/aidl/light/samsung_lights.h
similarity index 100%
rename from aidl/light/include/samsung_lights.h
rename to aidl/light/samsung_lights.h
diff --git a/hidl/consumerir/Android.bp b/hidl/consumerir/Android.bp
index 321b354..fb3e301 100644
--- a/hidl/consumerir/Android.bp
+++ b/hidl/consumerir/Android.bp
@@ -16,9 +16,9 @@
 
 cc_binary {
     name: "android.hardware.ir@1.0-service.samsung",
+    defaults: ["samsung_header_path_defaults"],
     relative_install_path: "hw",
     init_rc: ["android.hardware.ir@1.0-service.samsung.rc"],
-    local_include_dirs: ["include"],
     srcs: [
         "ConsumerIr.cpp",
         "service.cpp",
diff --git a/hidl/consumerir/include/samsung_ir.h b/hidl/consumerir/samsung_ir.h
similarity index 100%
rename from hidl/consumerir/include/samsung_ir.h
rename to hidl/consumerir/samsung_ir.h
diff --git a/hidl/fastcharge/Android.bp b/hidl/fastcharge/Android.bp
index 7a43a54..51b681e 100644
--- a/hidl/fastcharge/Android.bp
+++ b/hidl/fastcharge/Android.bp
@@ -16,10 +16,10 @@
 
 cc_binary {
     name: "vendor.lineage.fastcharge@1.0-service.samsung",
+    defaults: ["samsung_header_path_defaults"],
     relative_install_path: "hw",
     init_rc: ["vendor.lineage.fastcharge@1.0-service.samsung.rc"],
     vintf_fragments: ["vendor.lineage.fastcharge@1.0-service.samsung.xml"],
-    local_include_dirs: ["include"],
     srcs: [
         "FastCharge.cpp",
         "service.cpp",
diff --git a/hidl/fastcharge/FastCharge.cpp b/hidl/fastcharge/FastCharge.cpp
index 283b85b..7ee092f 100644
--- a/hidl/fastcharge/FastCharge.cpp
+++ b/hidl/fastcharge/FastCharge.cpp
@@ -19,10 +19,10 @@
 #include "FastCharge.h"
 #include <android-base/logging.h>
 #include <cutils/properties.h>
+#include <samsung_fastcharge.h>
 
 #include <fstream>
 #include <iostream>
-#include "samsung_fastcharge.h"
 
 namespace vendor {
 namespace lineage {
diff --git a/hidl/fastcharge/include/samsung_fastcharge.h b/hidl/fastcharge/samsung_fastcharge.h
similarity index 100%
rename from hidl/fastcharge/include/samsung_fastcharge.h
rename to hidl/fastcharge/samsung_fastcharge.h
diff --git a/hidl/powershare/Android.bp b/hidl/powershare/Android.bp
index 01938f8..3affa2b 100644
--- a/hidl/powershare/Android.bp
+++ b/hidl/powershare/Android.bp
@@ -16,10 +16,10 @@
 
 cc_binary {
     name: "vendor.lineage.powershare@1.0-service.samsung",
+    defaults: ["samsung_header_path_defaults"],
     relative_install_path: "hw",
     init_rc: ["vendor.lineage.powershare@1.0-service.samsung.rc"],
     vintf_fragments: ["vendor.lineage.powershare@1.0-service.samsung.xml"],
-    local_include_dirs: ["include"],
     srcs: [
         "PowerShare.cpp",
         "service.cpp",
diff --git a/hidl/powershare/PowerShare.cpp b/hidl/powershare/PowerShare.cpp
index 6332e5f..bf18370 100644
--- a/hidl/powershare/PowerShare.cpp
+++ b/hidl/powershare/PowerShare.cpp
@@ -18,9 +18,10 @@
 
 #include "PowerShare.h"
 #include <android-base/logging.h>
+#include <samsung_powershare.h>
+
 #include <fstream>
 #include <iostream>
-#include "samsung_powershare.h"
 
 namespace vendor {
 namespace lineage {
diff --git a/hidl/powershare/include/samsung_powershare.h b/hidl/powershare/samsung_powershare.h
similarity index 100%
rename from hidl/powershare/include/samsung_powershare.h
rename to hidl/powershare/samsung_powershare.h
diff --git a/hidl/touch/Android.bp b/hidl/touch/Android.bp
index e0fcd4e..8c73855 100644
--- a/hidl/touch/Android.bp
+++ b/hidl/touch/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The LineageOS Project
+// Copyright (C) 2019-2024 The LineageOS Project
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -15,12 +15,11 @@
 cc_binary {
     name: "vendor.lineage.touch@1.0-service.samsung",
     init_rc: ["vendor.lineage.touch@1.0-service.samsung.rc"],
-    defaults: ["hidl_defaults"],
+    defaults: ["samsung_header_path_defaults"],
     relative_install_path: "hw",
     // FIXME: this should be 'vendor: true' for modules that will eventually be
     // on AOSP.
     proprietary: true,
-    local_include_dirs: ["include"],
     srcs: [
         "GloveMode.cpp",
         "KeyDisabler.cpp",
diff --git a/hidl/touch/GloveMode.h b/hidl/touch/GloveMode.h
index 08fe4a7..c480aa7 100644
--- a/hidl/touch/GloveMode.h
+++ b/hidl/touch/GloveMode.h
@@ -19,7 +19,7 @@
 #include <hidl/MQDescriptor.h>
 #include <hidl/Status.h>
 #include <vendor/lineage/touch/1.0/IGloveMode.h>
-#include "samsung_touch.h"
+#include <samsung_touch.h>
 
 namespace vendor {
 namespace lineage {
diff --git a/hidl/touch/KeyDisabler.h b/hidl/touch/KeyDisabler.h
index 3d4464b..a29f4c0 100644
--- a/hidl/touch/KeyDisabler.h
+++ b/hidl/touch/KeyDisabler.h
@@ -19,7 +19,7 @@
 #include <hidl/MQDescriptor.h>
 #include <hidl/Status.h>
 #include <vendor/lineage/touch/1.0/IKeyDisabler.h>
-#include "samsung_touch.h"
+#include <samsung_touch.h>
 
 namespace vendor {
 namespace lineage {
diff --git a/hidl/touch/StylusMode.h b/hidl/touch/StylusMode.h
index 91bbee2..4541fca 100644
--- a/hidl/touch/StylusMode.h
+++ b/hidl/touch/StylusMode.h
@@ -19,7 +19,7 @@
 #include <hidl/MQDescriptor.h>
 #include <hidl/Status.h>
 #include <vendor/lineage/touch/1.0/IStylusMode.h>
-#include "samsung_touch.h"
+#include <samsung_touch.h>
 
 namespace vendor {
 namespace lineage {
diff --git a/hidl/touch/TouchscreenGesture.h b/hidl/touch/TouchscreenGesture.h
index 28bf9c8..cad4e46 100644
--- a/hidl/touch/TouchscreenGesture.h
+++ b/hidl/touch/TouchscreenGesture.h
@@ -19,7 +19,7 @@
 #include <hidl/MQDescriptor.h>
 #include <hidl/Status.h>
 #include <vendor/lineage/touch/1.0/ITouchscreenGesture.h>
-#include "samsung_touch.h"
+#include <samsung_touch.h>
 
 namespace vendor {
 namespace lineage {
diff --git a/hidl/touch/include/samsung_touch.h b/hidl/touch/samsung_touch.h
similarity index 100%
rename from hidl/touch/include/samsung_touch.h
rename to hidl/touch/samsung_touch.h