1## AAPT Flags
2# aapt doesn't accept multiple --extra-packages flags.
3# We have to collapse them into a single --extra-packages flag here.
4LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS))
5ifdef LOCAL_AAPT_FLAGS
6  ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),)
7    aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS))
8    aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags)))
9    aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages)))
10    LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \
11        --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages))
12    aapt_flags_extra_packages :=
13    aapt_flags :=
14  endif
15endif
16