Adding BOARD_NON_AB_OTA_DISABLE_COMPRESSION

Brotli decompression error occured during sideloading non A/B full OTA.
The flag disable brotli compression for non A/B full OTA.

The flag set if a device supports non A/B update.

Bug: 248350283
Test: build and sideload the full ota package.
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:64f700aad93501edbcfb0d2fa81b3bacc2194a73)
Merged-In: I1a7dcd0cbfc425629ec4a8b7dbe18f2937571c09
Change-Id: I1a7dcd0cbfc425629ec4a8b7dbe18f2937571c09
diff --git a/core/Makefile b/core/Makefile
index e1a08bf..9fe209f 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -5441,6 +5441,9 @@
 ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
 	$(hide) echo "allow_non_ab=true" >> $@
 endif
+ifeq ($(BOARD_NON_AB_OTA_DISABLE_COMPRESSION),true)
+	$(hide) echo "board_non_ab_ota_disable_compression=true" >> $@
+endif
 ifdef BOARD_PREBUILT_DTBOIMAGE
 	$(hide) echo "has_dtbo=true" >> $@
 ifeq ($(BOARD_AVB_ENABLE),true)
diff --git a/core/board_config.mk b/core/board_config.mk
index af05973..66f42c7 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -954,6 +954,11 @@
   endif
 endif
 
+# For Non A/B full OTA, disable brotli compression.
+ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
+  BOARD_NON_AB_OTA_DISABLE_COMPRESSION := true
+endif
+
 # Quick check for building generic OTA packages. Currently it only supports A/B OTAs.
 ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
   ifneq ($(AB_OTA_UPDATER),true)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 1e87b9c..e2a29f7 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -3403,7 +3403,7 @@
     #   compression_time:   75s  | 265s               | 719s
     #   decompression_time: 15s  | 25s                | 25s
 
-    if not self.src:
+    if not self.src and not OPTIONS.info_dict.get("board_non_ab_ota_disable_compression"):
       brotli_cmd = ['brotli', '--quality=6',
                     '--output={}.new.dat.br'.format(self.path),
                     '{}.new.dat'.format(self.path)]