Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cb030f4 authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge remote-tracking branch 'origin/lineage-21.0' into v1-u

parents c62e229f 5c2a1974
Loading
Loading
Loading
Loading
+3 −23
Original line number Diff line number Diff line
@@ -3878,11 +3878,9 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
  if board_builds_vendorimage:
    # In this case, the output sink is rooted at VENDOR
    recovery_img_path = "etc/recovery.img"
    recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat"
  elif not board_uses_vendorimage:
    # In this case the output sink is rooted at SYSTEM
    recovery_img_path = "vendor/etc/recovery.img"
    recovery_resource_dat_path = "SYSTEM/vendor/etc/recovery-resource.dat"
  else:
    logger.warning('Recovery patch generation is disable when prebuilt vendor image is used.')
    return None
@@ -3891,24 +3889,7 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
    output_sink(recovery_img_path, recovery_img.data)

  else:
    include_recovery_dtbo = info_dict.get("include_recovery_dtbo") == "true"
    include_recovery_acpio = info_dict.get("include_recovery_acpio") == "true"
    path = os.path.join(input_dir, recovery_resource_dat_path)
    # Use bsdiff to handle mismatching entries (Bug: 72731506)
    if include_recovery_dtbo or include_recovery_acpio:
      diff_program = ["bsdiff"]
      bonus_args = ""
      assert not os.path.exists(path)
    else:
      diff_program = ["imgdiff"]
      if os.path.exists(path):
        diff_program.append("-b")
        diff_program.append(path)
        bonus_args = "--bonus /vendor/etc/recovery-resource.dat"
      else:
        bonus_args = ""

    d = Difference(recovery_img, boot_img, diff_program=diff_program)
    d = Difference(recovery_img, boot_img)
    _, _, patch = d.ComputePatch()
    output_sink("recovery-from-boot.p", patch)

@@ -3946,7 +3927,7 @@ fi
  else:
    sh = """#!/vendor/bin/sh
if ! applypatch --check %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then
  applypatch %(bonus_args)s \\
  applypatch \\
          --patch /vendor/recovery-from-boot.p \\
          --source %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s \\
          --target %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s && \\
@@ -3962,8 +3943,7 @@ fi
       'boot_type': boot_type,
       'boot_device': boot_device + '$(getprop ro.boot.slot_suffix)',
       'recovery_type': recovery_type,
       'recovery_device': recovery_device + '$(getprop ro.boot.slot_suffix)',
       'bonus_args': bonus_args}
       'recovery_device': recovery_device + '$(getprop ro.boot.slot_suffix)'}

  # The install script location moved from /system/etc to /system/bin in the L
  # release. In the R release it is in VENDOR/bin or SYSTEM/vendor/bin.