extract_utils: Add support for overriding packages

* An example of how this can be used is say a device
   wants to use the original OEM camera, e.g. Essential PH-1.
   Klik is required in order to use the external camera
   module that you could buy for the device so it's preferred
   to use it over Camera2 or Snap.

  * An example of how to use this argument:
    -system/priv-app/Klik/Klik.apk;OVERRIDES=Camera2

Change-Id: I2504cbb760b20ed86c2dc088cc4bd74b78ba64d9
This commit is contained in:
TheStrix
2020-04-10 18:20:19 +05:30
committed by Luca Stefani
parent eed0c8ca3b
commit 3749ce5b29

View File

@@ -358,6 +358,7 @@ function write_blueprint_packages() {
local EXTENSION=
local PKGNAME=
local SRC=
local OVERRIDEPKG=
for P in "${FILELIST[@]}"; do
FILE=$(target_file "$P")
@@ -423,12 +424,21 @@ function write_blueprint_packages() {
SRC="$SRC/app"
fi
printf '\tapk: "%s/%s",\n' "$SRC" "$FILE"
if [ "$ARGS" = "PRESIGNED" ]; then
printf '\tpresigned: true,\n'
elif [ ! -z "$ARGS" ]; then
printf '\tcertificate: "%s",\n' "$ARGS"
else
ARGS=(${ARGS//;/ })
if [ -z "$ARGS" ]; then
printf '\tcertificate: "platform",\n'
else
for ARG in "${ARGS[@]}"; do
if [ "$ARG" = "PRESIGNED" ]; then
printf '\tpresigned: true,\n'
elif [[ "$ARG" =~ "OVERRIDES" ]]; then
OVERRIDEPKG=${ARG#*=}
OVERRIDEPKG=${OVERRIDEPKG//,/ }
printf '\toverrides: ["%s"],\n' "$OVERRIDEPKG"
elif [ ! -z "$ARG" ]; then
printf '\tcertificate: "%s",\n' "$ARG"
fi
done
fi
elif [ "$CLASS" = "JAVA_LIBRARIES" ]; then
printf 'dex_import {\n'