Support forcefully generating non-AB packages.
Force generate a non-A/B update package when requested.
Bug: 154344887
Test: ota_from_target_files.py --force_non_ab ...
Test: apply it as well
Change-Id: I5e81eb161722e07ef50081b6a16685cbc9963ae2
(cherry picked from commit 7169f754cc4b806c54a049b838355483575c1785)
Merged-In: I5e81eb161722e07ef50081b6a16685cbc9963ae2
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 2b04334..9f48f78 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -848,12 +848,13 @@
def LoadRecoveryFSTab(read_helper, fstab_version, recovery_fstab_path,
system_root_image=False):
class Partition(object):
- def __init__(self, mount_point, fs_type, device, length, context):
+ def __init__(self, mount_point, fs_type, device, length, context, slotselect):
self.mount_point = mount_point
self.fs_type = fs_type
self.device = device
self.length = length
self.context = context
+ self.slotselect = slotselect
try:
data = read_helper(recovery_fstab_path)
@@ -881,10 +882,13 @@
# It's a good line, parse it.
length = 0
+ slotselect = False
options = options.split(",")
for i in options:
if i.startswith("length="):
length = int(i[7:])
+ elif i == "slotselect":
+ slotselect = True
else:
# Ignore all unknown options in the unified fstab.
continue
@@ -898,7 +902,8 @@
mount_point = pieces[1]
d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2],
- device=pieces[0], length=length, context=context)
+ device=pieces[0], length=length, context=context,
+ slotselect=slotselect)
# / is used for the system mount point when the root directory is included in
# system. Other areas assume system is always at "/system" so point /system
@@ -913,7 +918,8 @@
"""Finds the path to recovery fstab and loads its contents."""
# recovery fstab is only meaningful when installing an update via recovery
# (i.e. non-A/B OTA). Skip loading fstab if device used A/B OTA.
- if info_dict.get('ab_update') == 'true':
+ if info_dict.get('ab_update') == 'true' and \
+ info_dict.get("allow_non_ab") != "true":
return None
# We changed recovery.fstab path in Q, from ../RAMDISK/etc/recovery.fstab to