Add support for /product-services partition

This CL is largely an adaptation of Change-Id
I774e6a38003734421591e51bed103802ff84f432

It adds the following variables:

- BOARD_AVB_PRODUCT_SERVICES_KEY_PATH
- BOARD_AVB_PRODUCT_SERVICES_ALGORITHM
- BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION
- BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
- BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT
- BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT
- BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE
- BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE
- BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE
- BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR
- BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT
- BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN
- BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
- BOARD_USES_PRODUCT_SERVICESIMAGE
- LOCAL_PRODUCT_SERVICES_MODULE
- PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH
- PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION
- PRODUCT_PRODUCT_SERVICES_PROPERTIES
- TARGET_COPY_OUT_PRODUCT_SERVICES
- TARGET_OUT_PRODUCT_SERVICES
- TARGET_OUT_PRODUCT_SERVICES_*

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and flashed
on device. Also successfully built image with /system/product-services directory
and no /product-services partition.
Change-Id: I5d229f6ac729ea6df9ff1f14cee2e28972cd9b4d
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 8e20859..d0c9d09 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -875,6 +875,27 @@
     copy_prop("product_extfs_inode_count", "extfs_inode_count")
     if not copy_prop("product_extfs_rsv_pct", "extfs_rsv_pct"):
       d["extfs_rsv_pct"] = "0"
+  elif mount_point == "product-services":
+    copy_prop("avb_productservices_hashtree_enable", "avb_hashtree_enable")
+    copy_prop("avb_productservices_add_hashtree_footer_args",
+              "avb_add_hashtree_footer_args")
+    copy_prop("avb_productservices_key_path", "avb_key_path")
+    copy_prop("avb_productservices_algorithm", "avb_algorithm")
+    copy_prop("productservices_fs_type", "fs_type")
+    copy_prop("productservices_size", "partition_size")
+    if not copy_prop("productservices_journal_size", "journal_size"):
+      d["journal_size"] = "0"
+    copy_prop("productservices_verity_block_device", "verity_block_device")
+    copy_prop("productservices_squashfs_compressor", "squashfs_compressor")
+    copy_prop("productservices_squashfs_compressor_opt",
+              "squashfs_compressor_opt")
+    copy_prop("productservices_squashfs_block_size", "squashfs_block_size")
+    copy_prop("productservices_squashfs_disable_4k_align",
+              "squashfs_disable_4k_align")
+    copy_prop("productservices_base_fs_file", "base_fs_file")
+    copy_prop("productservices_extfs_inode_count", "extfs_inode_count")
+    if not copy_prop("productservices_extfs_rsv_pct", "extfs_rsv_pct"):
+      d["extfs_rsv_pct"] = "0"
   elif mount_point == "oem":
     copy_prop("fs_type", "fs_type")
     copy_prop("oem_size", "partition_size")
@@ -955,6 +976,8 @@
       mount_point = "oem"
     elif image_filename == "product.img":
       mount_point = "product"
+    elif image_filename == "product-services.img":
+      mount_point = "product-services"
     else:
       print("error: unknown image file name ", image_filename, file=sys.stderr)
       sys.exit(1)