1// Copyright (C) 2019 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    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "frameworks_base_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["frameworks_base_license"],
22    default_team: "trendy_team_multitasking_windowing",
23}
24
25// Begin ProtoLog
26java_library {
27    name: "wm_shell_protolog-groups",
28    srcs: [
29        "src/com/android/wm/shell/protolog/ShellProtoLogGroup.java",
30        ":protolog-common-src",
31    ],
32}
33
34filegroup {
35    name: "wm_shell-sources",
36    srcs: [
37        "src/**/*.java",
38    ],
39    path: "src",
40}
41
42// Sources that have no dependencies that can be used directly downstream of this library
43// TODO(b/322791067): move these sources to WindowManager-Shell-shared
44filegroup {
45    name: "wm_shell_util-sources",
46    srcs: [
47        "src/com/android/wm/shell/animation/Interpolators.java",
48        "src/com/android/wm/shell/common/bubbles/*.kt",
49        "src/com/android/wm/shell/common/bubbles/*.java",
50        "src/com/android/wm/shell/common/magnetictarget/MagnetizedObject.kt",
51        "src/com/android/wm/shell/common/split/SplitScreenConstants.java",
52        "src/com/android/wm/shell/common/TransactionPool.java",
53        "src/com/android/wm/shell/common/TriangleShape.java",
54        "src/com/android/wm/shell/common/desktopmode/*.kt",
55        "src/com/android/wm/shell/draganddrop/DragAndDropConstants.java",
56        "src/com/android/wm/shell/pip/PipContentOverlay.java",
57        "src/com/android/wm/shell/startingsurface/SplashScreenExitAnimationUtils.java",
58        "src/com/android/wm/shell/sysui/ShellSharedConstants.java",
59        "src/com/android/wm/shell/util/**/*.java",
60    ],
61    path: "src",
62}
63
64// Aidls which can be used directly downstream of this library
65filegroup {
66    name: "wm_shell-aidls",
67    srcs: [
68        "src/**/*.aidl",
69    ],
70    path: "src",
71}
72
73// TODO(b/168581922) protologtool do not support kotlin(*.kt)
74filegroup {
75    name: "wm_shell-sources-kt",
76    srcs: [
77        "src/**/*.kt",
78    ],
79    path: "src",
80}
81
82genrule {
83    name: "wm_shell_protolog_src",
84    srcs: [
85        ":protolog-impl",
86        ":wm_shell_protolog-groups",
87        ":wm_shell-sources",
88    ],
89    tools: ["protologtool"],
90    cmd: "$(location protologtool) transform-protolog-calls " +
91        "--protolog-class com.android.internal.protolog.common.ProtoLog " +
92        "--loggroups-class com.android.wm.shell.protolog.ShellProtoLogGroup " +
93        "--loggroups-jar $(location :wm_shell_protolog-groups) " +
94        "--viewer-config-file-path /system_ext/etc/wmshell.protolog.pb " +
95        "--legacy-viewer-config-file-path /system_ext/etc/wmshell.protolog.json.gz " +
96        "--legacy-output-file-path /data/misc/wmtrace/shell_log.winscope " +
97        "--output-srcjar $(out) " +
98        "$(locations :wm_shell-sources)",
99    out: ["wm_shell_protolog.srcjar"],
100}
101
102genrule {
103    name: "generate-wm_shell_protolog.json",
104    srcs: [
105        ":wm_shell_protolog-groups",
106        ":wm_shell-sources",
107    ],
108    tools: ["protologtool"],
109    cmd: "$(location protologtool) generate-viewer-config " +
110        "--protolog-class com.android.internal.protolog.common.ProtoLog " +
111        "--loggroups-class com.android.wm.shell.protolog.ShellProtoLogGroup " +
112        "--loggroups-jar $(location :wm_shell_protolog-groups) " +
113        "--viewer-config-type json " +
114        "--viewer-config $(out) " +
115        "$(locations :wm_shell-sources)",
116    out: ["wm_shell_protolog.json"],
117}
118
119genrule {
120    name: "gen-wmshell.protolog.pb",
121    srcs: [
122        ":wm_shell_protolog-groups",
123        ":wm_shell-sources",
124    ],
125    tools: ["protologtool"],
126    cmd: "$(location protologtool) generate-viewer-config " +
127        "--protolog-class com.android.internal.protolog.common.ProtoLog " +
128        "--loggroups-class com.android.wm.shell.protolog.ShellProtoLogGroup " +
129        "--loggroups-jar $(location :wm_shell_protolog-groups) " +
130        "--viewer-config-type proto " +
131        "--viewer-config $(out) " +
132        "$(locations :wm_shell-sources)",
133    out: ["wmshell.protolog.pb"],
134}
135
136genrule {
137    name: "protolog.json.gz",
138    srcs: [":generate-wm_shell_protolog.json"],
139    out: ["wmshell.protolog.json.gz"],
140    cmd: "gzip -c < $(in) > $(out)",
141}
142
143prebuilt_etc {
144    name: "wmshell.protolog.json.gz",
145    system_ext_specific: true,
146    src: ":protolog.json.gz",
147    filename_from_src: true,
148}
149
150prebuilt_etc {
151    name: "wmshell.protolog.pb",
152    system_ext_specific: true,
153    src: ":gen-wmshell.protolog.pb",
154    filename_from_src: true,
155}
156
157// End ProtoLog
158
159java_library {
160    name: "WindowManager-Shell-proto",
161
162    srcs: ["proto/*.proto"],
163
164    proto: {
165        type: "nano",
166    },
167}
168
169filegroup {
170    name: "wm_shell-shared-aidls",
171
172    srcs: [
173        "shared/**/*.aidl",
174    ],
175
176    path: "shared/src",
177}
178
179java_library {
180    name: "WindowManager-Shell-shared",
181
182    srcs: [
183        "shared/**/*.java",
184        "shared/**/*.kt",
185        ":wm_shell-shared-aidls",
186    ],
187    static_libs: [
188        "androidx.dynamicanimation_dynamicanimation",
189        "jsr330",
190    ],
191}
192
193android_library {
194    name: "WindowManager-Shell",
195    srcs: [
196        ":wm_shell_protolog_src",
197        // TODO(b/168581922) protologtool do not support kotlin(*.kt)
198        ":wm_shell-sources-kt",
199        ":wm_shell-aidls",
200    ],
201    resource_dirs: [
202        "res",
203    ],
204    static_libs: [
205        "androidx.appcompat_appcompat",
206        "androidx.core_core-animation",
207        "androidx.core_core-ktx",
208        "androidx.arch.core_core-runtime",
209        "androidx.compose.material3_material3",
210        "androidx-constraintlayout_constraintlayout",
211        "androidx.dynamicanimation_dynamicanimation",
212        "androidx.recyclerview_recyclerview",
213        "kotlinx-coroutines-android",
214        "kotlinx-coroutines-core",
215        "//frameworks/libs/systemui:com_android_systemui_shared_flags_lib",
216        "//frameworks/libs/systemui:iconloader_base",
217        "com_android_wm_shell_flags_lib",
218        "com.android.window.flags.window-aconfig-java",
219        "WindowManager-Shell-proto",
220        "WindowManager-Shell-shared",
221        "perfetto_trace_java_protos",
222        "dagger2",
223        "jsr330",
224    ],
225    libs: [
226        // Soong fails to automatically add this dependency because all the
227        // *.kt sources are inside a filegroup.
228        "kotlin-annotations",
229    ],
230    kotlincflags: ["-Xjvm-default=all"],
231    manifest: "AndroidManifest.xml",
232    plugins: ["dagger2-compiler"],
233    use_resource_processor: true,
234}
235