1// Copyright (C) 2020 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_team: "trendy_team_aaos_framework",
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_defaults {
21    name: "carpowerpolicyserver_defaults",
22    cflags: [
23        "-Wall",
24        "-Wno-missing-field-initializers",
25        "-Werror",
26        "-Wno-unused-variable",
27        "-Wunused-parameter",
28    ],
29    shared_libs: [
30        "android.automotive.powerpolicy.delegate-V1-ndk",
31        "android.frameworks.automotive.powerpolicy-V3-ndk",
32        "android.frameworks.automotive.powerpolicy.internal-V1-ndk",
33        "android.hardware.automotive.vehicle@2.0",
34        "libbase",
35        "libbinder",
36        "libbinder_ndk",
37        "libhidlbase",
38        "liblog",
39        "libtinyxml2",
40        "libutils",
41        "server_configurable_flags",
42        "libaconfig_storage_read_api_cc",
43    ],
44    static_libs: [
45        "android.car.feature-aconfig-cpp",
46        "libc++fs",
47        "libsysfsmonitor",
48        "libvhalclient",
49    ],
50    defaults: ["vhalclient_defaults"],
51}
52
53cc_library {
54    name: "lib_carpowerpolicyserver",
55    srcs: [
56        "src/CarPowerPolicyServer.cpp",
57        "src/PolicyManager.cpp",
58        "src/PowerComponentHandler.cpp",
59        "src/SilentModeHandler.cpp",
60    ],
61    defaults: [
62        "carpowerpolicyserver_defaults",
63    ],
64    export_include_dirs: [
65        "src",
66    ],
67}
68
69filegroup {
70    name: "powerpolicyxmlfiles",
71    srcs: [
72        "tests/data/*.xml",
73    ],
74}
75
76cc_test {
77    name: "carpowerpolicyserver_test",
78    defaults: [
79        "carpowerpolicyserver_defaults",
80    ],
81    test_suites: ["general-tests"],
82    srcs: [
83        "tests/CarPowerPolicyServerTest.cpp",
84        "tests/PolicyManagerTest.cpp",
85        "tests/PowerComponentHandlerTest.cpp",
86        "tests/SilentModeHandlerTest.cpp",
87    ],
88    static_libs: [
89        "libgmock",
90        "libgtest",
91        "lib_carpowerpolicyserver",
92    ],
93    data: [":powerpolicyxmlfiles"],
94}
95
96cc_binary {
97    name: "carpowerpolicyd",
98    defaults: [
99        "carpowerpolicyserver_defaults",
100    ],
101    srcs: [
102        "src/main.cpp",
103    ],
104    static_libs: [
105        "lib_carpowerpolicyserver",
106    ],
107    init_rc: ["carpowerpolicyd.rc"],
108    vintf_fragments: ["carpowerpolicyd.xml"],
109}
110
111cc_fuzz {
112    name: "android.frameworks.automotive.powerpolicy.CarPowerPolicyServer.fuzzer",
113    defaults: [
114        "carpowerpolicyserver_defaults",
115        "service_fuzzer_defaults",
116    ],
117    static_libs: [
118        "liblog",
119        "lib_carpowerpolicyserver",
120    ],
121    srcs: ["src/fuzzer.cpp"],
122    fuzz_config: {
123        cc: [
124            "keithmok@google.com",
125        ],
126    },
127}
128