1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21cc_defaults {
22    name: "storaged_defaults",
23
24    shared_libs: [
25        "android.hardware.health@1.0",
26        "android.hardware.health@2.0",
27        "android.hardware.health-V2-ndk",
28        "libbase",
29        "libbinder",
30        "libbinder_ndk",
31        "libcutils",
32        "libhidlbase",
33        "liblog",
34        "libprotobuf-cpp-lite",
35        "libutils",
36        "libz",
37        "packagemanager_aidl-cpp",
38    ],
39
40    static_libs: [
41        "android.hardware.health-translate-ndk",
42        "libhealthhalutils",
43        "libhealthshim",
44    ],
45
46    cflags: [
47        "-Wall",
48        "-Werror",
49        "-Wextra",
50        "-Wno-unused-parameter"
51    ],
52}
53
54cc_library_static {
55    name: "libstoraged",
56
57    defaults: ["storaged_defaults"],
58
59    aidl: {
60        export_aidl_headers: true,
61        local_include_dirs: ["binder"],
62        include_dirs: ["frameworks/native/aidl/binder"],
63    },
64
65    srcs: [
66        "storaged.cpp",
67        "storaged_diskstats.cpp",
68        "storaged_info.cpp",
69        "storaged_service.cpp",
70        "storaged_utils.cpp",
71        "storaged_uid_monitor.cpp",
72        "uid_info.cpp",
73        "storaged.proto",
74        ":storaged_aidl",
75        ":storaged_aidl_private",
76    ],
77
78    header_libs: ["libbatteryservice_headers"],
79
80    logtags: ["EventLogTags.logtags"],
81
82    proto: {
83        type: "lite",
84        export_proto_headers: true,
85    },
86
87    export_include_dirs: ["include"],
88}
89
90cc_binary {
91    name: "storaged",
92
93    defaults: ["storaged_defaults"],
94
95    init_rc: ["storaged.rc"],
96
97    srcs: ["main.cpp"],
98
99    static_libs: [
100        "libstoraged",
101    ],
102}
103
104/*
105 * Run with:
106 *  adb shell /data/nativetest/storaged-unit-tests/storaged-unit-tests
107 */
108cc_test {
109    name: "storaged-unit-tests",
110
111    defaults: ["storaged_defaults"],
112
113    srcs: ["tests/storaged_test.cpp"],
114
115    static_libs: [
116        "libstoraged",
117    ],
118    test_suites: [
119        "general-tests",
120    ],
121}
122
123// AIDL interface between storaged and framework.jar
124filegroup {
125    name: "storaged_aidl",
126    srcs: [
127        "binder/android/os/IStoraged.aidl",
128    ],
129    path: "binder",
130}
131
132filegroup {
133    name: "storaged_aidl_private",
134    srcs: [
135        "binder/android/os/storaged/IStoragedPrivate.aidl",
136    ],
137    path: "binder",
138}
139