1# 2# Copyright (C) 2019 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 17# Generates one RRO for a given package. 18# $(1) target package name 19# $(2) name of the RRO set (e.g. "base") 20# $(3) resources folder 21define generate-rro 22 include $$(CLEAR_VARS) 23 24 rro_package_name := $(subst .,-,$(2))-$(subst .,-,$(1)) 25 manifest_file := $(4) 26 LOCAL_RESOURCE_DIR := $(3) 27 LOCAL_RRO_THEME := $$(rro_package_name) 28 LOCAL_PACKAGE_NAME := $$(rro_package_name) 29 LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 30 LOCAL_LICENSE_CONDITIONS := notice 31 LOCAL_CERTIFICATE := platform 32 LOCAL_SDK_VERSION := current 33 LOCAL_USE_AAPT2 := true 34 35 # Add --no-resource-deduping to prevent overlays to "values-port" with the same 36 # value as in "values" from being removed 37 LOCAL_AAPT_FLAGS := --no-resource-deduping 38 39 gen := $$(call intermediates-dir-for,ETC,$$(rro_package_name))/AndroidManifest.xml 40 $$(gen): $$(manifest_file) 41 @echo Generate $$@ 42 $$(hide) mkdir -p $$(dir $$@) 43 $$(hide) sed -e "s/{{TARGET_PACKAGE_NAME}}/$(1)/" \ 44 -e "s/{{RRO_PACKAGE_NAME}}/$(1).$(2).rro/" $$< > $$@ 45 LOCAL_FULL_MANIFEST_FILE := $$(gen) 46 47 include $$(BUILD_RRO_PACKAGE) 48endef 49 50ifndef CAR_UI_RRO_MANIFEST_FILE 51CAR_UI_RRO_MANIFEST_FILE = $(LOCAL_PATH)/AndroidManifest.xml 52endif 53 54$(foreach t,\ 55 $(CAR_UI_RRO_TARGETS),\ 56 $(eval $(call generate-rro,$(t),$(CAR_UI_RRO_SET_NAME),$(CAR_UI_RESOURCE_DIR),$(CAR_UI_RRO_MANIFEST_FILE))) \ 57 ) 58 59# Clear variables 60CAR_UI_RRO_SET_NAME := 61CAR_UI_RRO_MANIFEST_FILE := 62CAR_UI_RESOURCE_DIR := 63CAR_UI_RRO_TARGETS := 64