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        "[email protected]",
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        "libsysfsmonitor",
47        "libvhalclient",
48    ],
49    defaults: ["vhalclient_defaults"],
50}
51
52cc_library {
53    name: "lib_carpowerpolicyserver",
54    srcs: [
55        "src/CarPowerPolicyServer.cpp",
56        "src/PolicyManager.cpp",
57        "src/PowerComponentHandler.cpp",
58        "src/SilentModeHandler.cpp",
59    ],
60    defaults: [
61        "carpowerpolicyserver_defaults",
62    ],
63    export_include_dirs: [
64        "src",
65    ],
66}
67
68filegroup {
69    name: "powerpolicyxmlfiles",
70    srcs: [
71        "tests/data/*.xml",
72    ],
73}
74
75cc_test {
76    name: "carpowerpolicyserver_test",
77    defaults: [
78        "carpowerpolicyserver_defaults",
79    ],
80    test_suites: ["general-tests"],
81    srcs: [
82        "tests/CarPowerPolicyServerTest.cpp",
83        "tests/PolicyManagerTest.cpp",
84        "tests/PowerComponentHandlerTest.cpp",
85        "tests/SilentModeHandlerTest.cpp",
86    ],
87    static_libs: [
88        "libgmock",
89        "libgtest",
90        "lib_carpowerpolicyserver",
91    ],
92    data: [":powerpolicyxmlfiles"],
93}
94
95vintf_fragment {
96    name: "carpowerpolicyd.xml",
97    src: "carpowerpolicyd.xml",
98}
99
100cc_binary {
101    name: "carpowerpolicyd",
102    defaults: [
103        "carpowerpolicyserver_defaults",
104    ],
105    srcs: [
106        "src/main.cpp",
107    ],
108    static_libs: [
109        "lib_carpowerpolicyserver",
110    ],
111    init_rc: ["carpowerpolicyd.rc"],
112    vintf_fragment_modules: ["carpowerpolicyd.xml"],
113}
114
115cc_fuzz {
116    name: "android.frameworks.automotive.powerpolicy.CarPowerPolicyServer.fuzzer",
117    defaults: [
118        "carpowerpolicyserver_defaults",
119        "service_fuzzer_defaults",
120    ],
121    static_libs: [
122        "liblog",
123        "lib_carpowerpolicyserver",
124    ],
125    srcs: ["src/fuzzer.cpp"],
126    fuzz_config: {
127        cc: [
128            "[email protected]",
129        ],
130    },
131}
132