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
diff --git a/extract_utils.sh b/extract_utils.sh
index 7d2785f..94c717d 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -358,6 +358,7 @@
local EXTENSION=
local PKGNAME=
local SRC=
+ local OVERRIDEPKG=
for P in "${FILELIST[@]}"; do
FILE=$(target_file "$P")
@@ -423,12 +424,21 @@
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'