From 0e9898d708fd9c1b62d4647371b0b92c6d25f9d5 Mon Sep 17 00:00:00 2001 From: Sebastiano Barezzi Date: Mon, 7 Jun 2021 18:03:18 +0200 Subject: [PATCH] sm8250-common: fod: Move to AOSP Soong conditionals Change-Id: Iaf7c291d2f08262d9f578901d688eb98ade4beba --- fod/Android.bp | 34 ++++++++++++++++++++++++++++++---- soong/Android.bp | 17 ----------------- soong/fod.go | 40 ---------------------------------------- soong/main.go | 9 --------- 4 files changed, 30 insertions(+), 70 deletions(-) delete mode 100644 soong/Android.bp delete mode 100644 soong/fod.go delete mode 100644 soong/main.go diff --git a/fod/Android.bp b/fod/Android.bp index 49dbb6e..8d28f97 100644 --- a/fod/Android.bp +++ b/fod/Android.bp @@ -1,5 +1,5 @@ // -// Copyright (C) 2019 The LineageOS Project +// Copyright (C) 2019-2021 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. @@ -13,10 +13,36 @@ // See the License for the specific language governing permissions and // limitations under the License. -oneplus_kona_fod_hal_binary { - relative_install_path: "hw", - defaults: ["hidl_defaults"], +soong_config_module_type { + name: "oneplus_kona_fod_hal_cc_defaults", + module_type: "cc_defaults", + config_namespace: "ONEPLUS_KONA_FOD", + value_variables: ["POS_X", "POS_Y", "SIZE"], + properties: ["cppflags"], +} + +oneplus_kona_fod_hal_cc_defaults { + name: "oneplus_kona_fod_hal_defaults", + soong_config_variables: { + POS_X: { + cppflags: ["-DFOD_POS_X=%s"], + }, + POS_Y: { + cppflags: ["-DFOD_POS_Y=%s"], + }, + SIZE: { + cppflags: ["-DFOD_SIZE=%s"], + }, + }, +} + +cc_binary { name: "vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_kona", + defaults: [ + "hidl_defaults", + "oneplus_kona_fod_hal_defaults", + ], + relative_install_path: "hw", init_rc: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_kona.rc"], vintf_fragments: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_kona.xml"], srcs: ["service.cpp", "FingerprintInscreen.cpp"], diff --git a/soong/Android.bp b/soong/Android.bp deleted file mode 100644 index fa070e6..0000000 --- a/soong/Android.bp +++ /dev/null @@ -1,17 +0,0 @@ -bootstrap_go_package { - name: "soong-oneplus-kona-plugins", - pkgPath: "device/oneplus/sm8250-common", - deps: [ - "blueprint", - "blueprint-pathtools", - "soong", - "soong-android", - "soong-cc", - "soong-genrule", - ], - srcs: [ - "fod.go", - "main.go", - ], - pluginFor: ["soong_build"], -} diff --git a/soong/fod.go b/soong/fod.go deleted file mode 100644 index 00679d7..0000000 --- a/soong/fod.go +++ /dev/null @@ -1,40 +0,0 @@ -package kona - -import ( - "android/soong/android" - "android/soong/cc" - "strings" -) - -func fodFlags(ctx android.BaseContext) []string { - var cflags []string - - var config = ctx.AConfig().VendorConfig("ONEPLUS_KONA_FOD") - var posX = strings.TrimSpace(config.String("POS_X")) - var posY = strings.TrimSpace(config.String("POS_Y")) - var size = strings.TrimSpace(config.String("SIZE")) - - cflags = append(cflags, "-DFOD_POS_X=" + posX, "-DFOD_POS_Y=" + posY, "-DFOD_SIZE=" + size) - return cflags -} - -func fodHalBinary(ctx android.LoadHookContext) { - type props struct { - Target struct { - Android struct { - Cflags []string - } - } - } - - p := &props{} - p.Target.Android.Cflags = fodFlags(ctx) - ctx.AppendProperties(p) -} - -func fodHalBinaryFactory() android.Module { - module, _ := cc.NewBinary(android.HostAndDeviceSupported) - newMod := module.Init() - android.AddLoadHook(newMod, fodHalBinary) - return newMod -} diff --git a/soong/main.go b/soong/main.go deleted file mode 100644 index bc1d727..0000000 --- a/soong/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package kona - -import ( - "android/soong/android" -) - -func init() { - android.RegisterModuleType("oneplus_kona_fod_hal_binary", fodHalBinaryFactory) -}