overlays: add support for overlays

Co-authored-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
TheScarastic 2021-10-21 10:27:47 +00:00 committed by AdarshGrewal
parent d047117d70
commit afe58dfd6f
4 changed files with 80 additions and 0 deletions

23
exclude-tag.txt Normal file
View File

@ -0,0 +1,23 @@
array:config_face_acquire_vendor_biometricprompt_ignorelist
array:config_face_acquire_vendor_enroll_ignorelist
array:config_face_acquire_vendor_keyguard_ignorelist
array:config_notificationMsgPkgsAllowedAsConvos
array:esim_activation_supported_countries
array:face_acquired_vendor
bool:config_hspa_data_distinguishable
bool:config_nfc_conflict_with_usb_audio
bool:config_nfc_conflict_with_wlc
bool:config_wlc_support_enabled
bool:hac_enabled
bool:vvm3_enabled
dimen:qs_brightness_margin_top
integer-array:config_nfc_conflict_with_usb_audio_productid
integer-array:config_nfc_conflict_with_usb_audio_vendorid
integer-array:non_removable_euicc_slots
string:def_wireless_charging_started_sound
string:config_secondaryLocationTimeZoneProviderPackageName
string-array:config_defaultFirstUserRestrictions
string-array:config_highRefreshRateBlacklist
string-array:config_nightDisplayColorTemperatureCoefficients
string-array:enabled_networks_except_gsm_values
string-array:enabled_networks_values

View File

@ -55,9 +55,34 @@ fi
function blob_fixup() { function blob_fixup() {
case "${1}" in case "${1}" in
product/overlay/*apk)
starletMagic $1 $2 &
;;
esac esac
} }
function starletMagic() {
folder=${2/.apk/}
echo " "${folder##*/} "\\" >> "${MY_DIR}/${DEVICE}/overlays.mk"
apktool -q d "$2" -o $folder -f
rm -rf $2 $folder/{apktool.yml,original,res/values/public.xml,unknown}
cp ${MY_DIR}/overlay-template.txt $folder/Android.bp
sed -i "s|dummy|${folder##*/}|g" $folder/Android.bp
find $folder -type f -name AndroidManifest.xml -exec sed -i "s|extractNativeLibs\=\"false\"|extractNativeLibs\=\"true\"|g" {} \;
for file in $(find $folder/res -name *xml ! -path "$folder/res/raw" ! -path "$folder/res/drawable*" ! -path "$folder/res/xml"); do
for tag in $(cat exclude-tag.txt); do
type=$(echo $tag | cut -d: -f1)
node=$(echo $tag | cut -d: -f2)
xmlstarlet ed -L -d "/resources/$type[@name="\'$node\'"]" $file
xmlstarlet fo -s 4 $file > $file.bak
mv $file.bak $file
done
sed -i "s|\?android:\^attr-private|\@\*android\:attr|g" $file
sed -i "s|\@android\:color|\@\*android\:color|g" $file
sed -i "s|\^attr-private|attr|g" $file
done
}
if [ -z "$SRC" ]; then if [ -z "$SRC" ]; then
echo "Path to system dump not specified! Specify one with --path" echo "Path to system dump not specified! Specify one with --path"
exit 1 exit 1
@ -66,6 +91,12 @@ fi
# Initialize the helper # Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
echo "PRODUCT_PACKAGES += \\" > "${MY_DIR}/${DEVICE}/overlays.mk"
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
"${MY_DIR}/setup-makefiles.sh" "${MY_DIR}/setup-makefiles.sh"
echo "Waiting for extraction"
wait
echo "All done"

23
overlay-template.txt Normal file
View File

@ -0,0 +1,23 @@
//
// Copyright (C) 2021 The Android Open-Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
runtime_resource_overlay {
name: "dummy",
theme: "dummy",
certificate: "platform",
sdk_version: "current",
product_specific: true
}

View File

@ -37,3 +37,6 @@ write_makefiles "${MY_DIR}/proprietary-files.txt" true
# Finish # Finish
write_footers write_footers
# Overlays
echo -e "\ninclude vendor/gms/common/overlays.mk" >> $PRODUCTMK