1// 2// Copyright (C) 2008 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: ["frameworks_base_core_res_license"], 19} 20 21// Added automatically by a large-scale-change that took the approach of 22// 'apply every license found to every target'. While this makes sure we respect 23// every license restriction, it may not be entirely correct. 24// 25// e.g. GPL in an MIT project might only apply to the contrib/ directory. 26// 27// Please consider splitting the single license below into multiple licenses, 28// taking care not to lose any license_kind information, and overriding the 29// default license using the 'licenses: [...]' property on targets as needed. 30// 31// For unused files, consider creating a 'fileGroup' with "//visibility:private" 32// to attach the license to, and including a comment whether the files may be 33// used in the current project. 34// See: http://go/android-license-faq 35license { 36 name: "frameworks_base_core_res_license", 37 visibility: [":__subpackages__"], 38 license_kinds: [ 39 "SPDX-license-identifier-Apache-2.0", 40 ], 41 license_text: [ 42 "NOTICE", 43 ], 44} 45 46genrule { 47 name: "remote-color-resources-compile-public", 48 tools: ["aapt2"], 49 srcs: [ 50 "remote_color_resources_res/values/public.xml", 51 ], 52 out: ["values_public.arsc.flat"], 53 cmd: "$(location aapt2) compile $(in) -o $(genDir)", 54} 55 56genrule { 57 name: "remote-color-resources-compile-colors", 58 tools: ["aapt2"], 59 srcs: [ 60 "remote_color_resources_res/values/colors.xml", 61 ], 62 out: ["values_colors.arsc.flat"], 63 cmd: "$(location aapt2) compile $(in) -o $(genDir)", 64} 65 66genrule { 67 name: "remote-color-resources-apk", 68 tools: ["aapt2"], 69 // The first input file in the list must be the manifest 70 srcs: [ 71 "RemoteThemeColorsAndroidManifest.xml", 72 ":remote-color-resources-compile-public", 73 ":remote-color-resources-compile-colors", 74 ], 75 out: ["remote-color-resources.apk"], 76 cmd: "$(location aapt2) link -o $(out) --manifest $(in)", 77} 78 79genrule { 80 name: "remote-color-resources-arsc", 81 srcs: [":remote-color-resources-apk"], 82 out: ["res/raw/remote_views_color_resources.arsc"], 83 cmd: "mkdir -p $(genDir)/remote-color-resources-arsc && " + 84 "unzip -x $(in) resources.arsc -d $(genDir)/remote-color-resources-arsc && " + 85 "mkdir -p $$(dirname $(out)) && " + 86 "mv $(genDir)/remote-color-resources-arsc/resources.arsc $(out) && " + 87 "echo 'Created $(out)'", 88} 89 90genrule { 91 name: "remote-color-resources-arsc-zip", 92 tools: ["soong_zip"], 93 srcs: [ 94 ":remote-color-resources-arsc", 95 "remote_color_resources_res/symbols.xml", 96 ], 97 out: ["remote_views_color_resources.zip"], 98 cmd: "INPUTS=($(in)) && " + 99 "RES_DIR=$$(dirname $$(dirname $${INPUTS[0]})) && " + 100 "mkdir -p $$RES_DIR/values && " + 101 "cp $${INPUTS[1]} $$RES_DIR/values && " + 102 "$(location soong_zip) -o $(out) -C $$RES_DIR -D $$RES_DIR", 103} 104 105android_app { 106 name: "framework-res", 107 use_resource_processor: false, 108 sdk_version: "core_platform", 109 certificate: "platform", 110 111 srcs: [ 112 ":remote-color-resources-arsc", 113 ], 114 115 // Disable dexpreopt and verify_uses_libraries check as the app 116 // contains no Java code to be dexpreopted. 117 enforce_uses_libs: false, 118 dex_preopt: { 119 enabled: false, 120 }, 121 122 // Soong special-cases framework-res to install this alongside 123 // the libraries at /system/framework/framework-res.apk. 124 125 // Generate private symbols into the com.android.internal.R class 126 // so they are not accessible to 3rd party apps. 127 aaptflags: [ 128 "--private-symbols", 129 "com.android.internal", 130 131 // Framework doesn't need versioning since it IS the platform. 132 "--no-auto-version", 133 134 // Allow overlay to add resource 135 "--auto-add-overlay", 136 137 // Framework resources benefit tremendously from enabling sparse encoding, saving tens 138 // of MBs in size and RAM use. 139 "--enable-sparse-encoding", 140 ], 141 142 resource_zips: [ 143 ":remote-color-resources-arsc-zip", 144 ], 145 146 // Create package-export.apk, which other packages can use to get 147 // PRODUCT-agnostic resource data like IDs and type definitions. 148 export_package_resources: true, 149 150 dist: { 151 targets: [ 152 "simulated_device_launcher", 153 ], 154 }, 155 156 generate_product_characteristics_rro: true, 157 158 flags_packages: [ 159 "android.app.appfunctions.flags-aconfig", 160 "android.app.contextualsearch.flags-aconfig", 161 "android.app.flags-aconfig", 162 "android.appwidget.flags-aconfig", 163 "android.companion.virtualdevice.flags-aconfig", 164 "android.content.pm.flags-aconfig", 165 "android.location.flags-aconfig", 166 "android.media.audio-aconfig", 167 "android.provider.flags-aconfig", 168 "camera_platform_flags", 169 "android.net.platform.flags-aconfig", 170 "com.android.window.flags.window-aconfig", 171 "android.permission.flags-aconfig", 172 "android.os.flags-aconfig", 173 "android.os.vibrator.flags-aconfig", 174 "android.media.tv.flags-aconfig", 175 "android.security.flags-aconfig", 176 "device_policy_aconfig_flags", 177 "com.android.hardware.input.input-aconfig", 178 "aconfig_trade_in_mode_flags", 179 "art-aconfig-flags", 180 "ranging_aconfig_flags", 181 "aconfig_settingslib_flags", 182 "telephony_flags", 183 ], 184} 185 186java_genrule { 187 name: "framework-res-package-jar", 188 srcs: [":framework-res{.export-package.apk}"], 189 out: ["framework-res-package.jar"], 190 cmd: "cp $(in) $(out)", 191} 192 193// Generate a text file containing a list of permissions that non-system apps 194// are allowed to obtain. 195genrule { 196 name: "permission-list-normal", 197 out: ["permission-list-normal.txt"], 198 srcs: ["AndroidManifest.xml"], 199 cmd: "cat $(in) " + 200 // xmllint has trouble accessing attributes under the android namespace. 201 // Strip these prefixes prior to processing with xmllint. 202 " | sed -r 's/android:(name|protectionLevel)/\\1/g' " + 203 " | $(location xmllint) /dev/stdin --xpath " + 204 " '//permission[not(contains(@protectionLevel, \"signature\"))]/@name'" + 205 // The result of xmllint is name="value" pairs. Format these to just the 206 // permission name, one per-line. 207 " | sed -r 's/\\s*name=\\s*//g' | tr -d '\"'" + 208 " > $(out)", 209 tools: ["xmllint"], 210} 211 212filegroup { 213 name: "frameworks-base-core-AndroidManifest.xml", 214 srcs: ["AndroidManifest.xml"], 215 visibility: [ 216 "//frameworks/base", 217 "//frameworks/base/api", 218 ], 219} 220