sm8350-common: fod: Move to AOSP Soong conditionals

Change-Id: Iaf7c291d2f08262d9f578901d688eb98ade4beba
This commit is contained in:
Sebastiano Barezzi 2021-06-07 18:03:18 +02:00 committed by Bruno Martins
parent 58cb8ab963
commit 7a0b534427
4 changed files with 30 additions and 70 deletions

View file

@ -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"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with 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 // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
oneplus_lahaina_fod_hal_binary { soong_config_module_type {
relative_install_path: "hw", name: "oneplus_lahaina_fod_hal_cc_defaults",
defaults: ["hidl_defaults"], module_type: "cc_defaults",
config_namespace: "ONEPLUS_LAHAINA_FOD",
value_variables: ["POS_X", "POS_Y", "SIZE"],
properties: ["cppflags"],
}
oneplus_lahaina_fod_hal_cc_defaults {
name: "oneplus_lahaina_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_lahaina", name: "vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina",
defaults: [
"hidl_defaults",
"oneplus_lahaina_fod_hal_defaults",
],
relative_install_path: "hw",
init_rc: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.rc"], init_rc: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.rc"],
vintf_fragments: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.xml"], vintf_fragments: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.xml"],
srcs: ["service.cpp", "FingerprintInscreen.cpp"], srcs: ["service.cpp", "FingerprintInscreen.cpp"],

View file

@ -1,17 +0,0 @@
bootstrap_go_package {
name: "soong-oneplus-lahaina-plugins",
pkgPath: "device/oneplus/sm8350-common",
deps: [
"blueprint",
"blueprint-pathtools",
"soong",
"soong-android",
"soong-cc",
"soong-genrule",
],
srcs: [
"fod.go",
"main.go",
],
pluginFor: ["soong_build"],
}

View file

@ -1,40 +0,0 @@
package lahaina
import (
"android/soong/android"
"android/soong/cc"
"strings"
)
func fodFlags(ctx android.BaseContext) []string {
var cflags []string
var config = ctx.AConfig().VendorConfig("ONEPLUS_LAHAINA_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
}

View file

@ -1,9 +0,0 @@
package lahaina
import (
"android/soong/android"
)
func init() {
android.RegisterModuleType("oneplus_lahaina_fod_hal_binary", fodHalBinaryFactory)
}