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 := $(2)-$(subst .,-,$(1)) 25 LOCAL_RESOURCE_DIR := $(3) 26 LOCAL_RRO_THEME := $$(rro_package_name) 27 LOCAL_PACKAGE_NAME := $$(rro_package_name) 28 LOCAL_CERTIFICATE := platform 29 LOCAL_SDK_VERSION := current 30 LOCAL_USE_AAPT2 := true 31 32 # Add --no-resource-deduping to prevent overlays to "values-port" with the same 33 # value as in "values" from being removed 34 LOCAL_AAPT_FLAGS := --no-resource-deduping 35 36 gen := $$(call intermediates-dir-for,ETC,$$(rro_package_name))/AndroidManifest.xml 37 $$(gen): $(LOCAL_PATH)/AndroidManifest.xml 38 @echo Generate $$@ 39 $$(hide) mkdir -p $$(dir $$@) 40 $$(hide) sed -e "s/{{TARGET_PACKAGE_NAME}}/$(1)/" \ 41 -e "s/{{RRO_PACKAGE_NAME}}/$(1).$(2).rro/" $$< > $$@ 42 LOCAL_FULL_MANIFEST_FILE := $$(gen) 43 44 include $$(BUILD_RRO_PACKAGE) 45endef 46 47$(foreach t,\ 48 $(CAR_UI_RRO_TARGETS),\ 49 $(eval $(call generate-rro,$(t),$(CAR_UI_RRO_SET_NAME),$(CAR_UI_RESOURCE_DIR)))) 50 51# Clear variables 52CAR_UI_RRO_SET_NAME := 53CAR_UI_RESOURCE_DIR := 54CAR_UI_RRO_TARGETS := 55