1// Copyright (C) 2022 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_applicable_licenses: ["Android-Apache-2.0"], 17} 18 19filegroup { 20 name: "adservicesapk-filegroup", 21 srcs: [ 22 "java/**/*.java", 23 ], 24} 25 26android_app_certificate { 27 name: "com.android.adservices.api.certificate", 28 certificate: "com.android.adservices.api", 29} 30 31android_library { 32 name: "AdServicesLib", 33 sdk_version: "module_current", 34 min_sdk_version: "30", 35 srcs: [ 36 "java/**/*.java", 37 ], 38 libs: [ 39 "android.ext.adservices", 40 "framework-annotations-lib", 41 ], 42 optional_uses_libs: ["android.ext.adservices"], 43 manifest: "EmptyManifest.xml", 44 static_libs: [ 45 "adservices-service-core", 46 "androidx-constraintlayout_constraintlayout", 47 "androidx.preference_preference", 48 "androidx.fragment_fragment", 49 "androidx.recyclerview_recyclerview", 50 // TODO(b/230653497): Try to remove this. 51 "androidx.room_room-runtime", 52 "mobile_data_downloader_lib", 53 "tflite_support_classifiers_java", 54 "SettingsLibActionBarShadow", 55 "SettingsLibSettingsTheme", 56 "SettingsLibCollapsingToolbarBaseActivity", 57 "SettingsLibMainSwitchPreference", 58 ], 59 // TODO(b/269145496): Remove dex_preopt: false. 60 dex_preopt: { 61 enabled: false, 62 }, 63 jarjar_rules: "jarjar_rules.txt", 64 resource_dirs: ["res"], 65 aaptflags: [ 66 // Don't compress *.tflite files. Compressed models cannot be loaded on device. 67 "-0 .tflite", 68 ], 69 optimize: { 70 proguard_flags_files: ["proguard.flags"], 71 }, 72 apex_available: [ 73 "com.android.adservices", 74 "com.android.extservices", 75 ], 76 lint: { 77 extra_check_modules: ["AdServicesProdLintChecker"], 78 }, 79} 80 81android_library { 82 name: "AdServices-core", 83 sdk_version: "module_current", 84 // This is not enforced by PackageManager but we keep this 85 // here since this APK is used for S- only. 86 // TODO(b/263904312): Support for max_sdk_version. 87 max_sdk_version: "32", 88 min_sdk_version: "30", 89 static_libs: ["AdServicesLib"], 90 manifest: "AdExtServicesManifest.xml", 91 apex_available: ["com.android.extservices"], 92} 93 94android_app { 95 name: "AdServicesApk", 96 sdk_version: "module_current", 97 min_sdk_version: "Tiramisu", 98 certificate: ":com.android.adservices.api.certificate", 99 privileged: true, 100 privapp_allowlist: ":privapp_allowlist_com.android.adservices.api.xml", 101 srcs: [], 102 static_libs: [ 103 "AdServicesLib", 104 ], 105 jarjar_rules: "jarjar_rules.txt", 106 resource_dirs: ["publicres"], 107 aaptflags: [ 108 // Don't compress *.tflite files. Compressed models cannot be loaded on device. 109 "-0 .tflite", 110 ], 111 optimize: { 112 shrink_resources: true, 113 proguard_flags_files: ["proguard.flags"], 114 }, 115 apex_available: ["com.android.adservices"], 116 updatable: true, 117} 118 119// Assets needs to be bundled via this android_library since our classes in service-core needs to 120// load assets. 121android_library { 122 name: "adservices-assets", 123 sdk_version: "module_current", 124 min_sdk_version: "30", 125 static_libs: [ 126 "androidx-constraintlayout_constraintlayout", 127 "SettingsLibSettingsTheme", 128 ], 129 asset_dirs: [ 130 "assets", 131 ], 132 aaptflags: [ 133 // Don't compress *.tflite files. Compressed models cannot be loaded on device. 134 "-0 .tflite", 135 ], 136 // Must use EmptyManifest.xml since "adservices-assets" will also be used by the 137 // service-core tests. If we use the normal "AndroidManifest.xml", we will redeclare permissions 138 // in the tests. 139 // See b/228270294 for the error about duplicated permissions. 140 manifest: "EmptyManifest.xml", 141} 142