| /* | |
| * Copyright (C) 2026 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an "AS IS" BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| rust_bindgen { | |
| name: "libmemorybudgetmanager_bindgen", | |
| crate_name: "memorybudgetmanager_bindgen", | |
| wrapper_src: "wrapper.h", | |
| source_stem: "bindings", | |
| header_libs: [ | |
| "native_headers", | |
| "libmemorybudgetmanager_headers_private", | |
| ], | |
| bindgen_flags: [ | |
| "--allowlist-type=MemoryBudgetWatcherEventMask", | |
| "--allowlist-type=MemoryBudgetEvent", | |
| "--allowlist-type=MemoryBudgetResult", | |
| "--default-enum-style rust", | |
| "--bitfield-enum=MemoryBudgetWatcherEventMask", | |
| ], | |
| } | |
| cc_library_static { | |
| name: "libmemorybudgetmanager_looper_wrapper", | |
| srcs: ["looper_wrapper.cpp"], | |
| shared_libs: [ | |
| "libutils", | |
| ], | |
| } | |
| rust_ffi_shared { | |
| name: "libmemorybudgetmanager", | |
| crate_name: "memorybudgetmanager", | |
| srcs: ["src/lib.rs"], | |
| edition: "2024", | |
| export_header_lib_headers: ["libmemorybudgetmanager_headers_private"], | |
| prefer_rlib: true, | |
| rustlibs: [ | |
| "liblibc", | |
| "librustix", | |
| "libprocessgroup_rust", | |
| "libbinder_rs", | |
| "memory_budget_service_aidl-rust", | |
| "libmemorybudgetmanager_bindgen", | |
| ], | |
| static_libs: [ | |
| "libmemorybudgetmanager_looper_wrapper", | |
| ], | |
| shared_libs: [ | |
| // We link libutils directly for Looper without needing libandroid.so. | |
| "libutils", | |
| "liblog", | |
| ], | |
| } | |
| rust_test { | |
| name: "libmemorybudgetmanager_rust_test", | |
| team: "trendy_team_system_performance", | |
| crate_name: "memorybudgetmanager_test", | |
| srcs: ["src/lib.rs"], | |
| edition: "2024", | |
| rustlibs: [ | |
| "liblibc", | |
| "librustix", | |
| "libprocessgroup_rust", | |
| "libbinder_rs", | |
| "memory_budget_service_aidl-rust", | |
| "libmemorybudgetmanager_bindgen", | |
| ], | |
| static_libs: [ | |
| "libmemorybudgetmanager_looper_wrapper", | |
| ], | |
| shared_libs: [ | |
| "libutils", | |
| ], | |
| test_suites: ["general-tests"], | |
| } |