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

Commit 1bbd8c6d authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
Browse files

recovery: Handle LINEAGE_VERSION_APPEND_TIME_OF_DAY in ver_date

Change-Id: Ia4c4b5e6544e5ac8a88aadd495dbfd06c210828d
parent a3c4c6db
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -733,11 +733,12 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
    ui->SetStage(st_cur, st_max);
  }

  // Extract the YYYYMMDD date from the full version string. Assume
  // the first instance of "-[0-9]{8}-" (if any) has the desired date.
  // Extract the YYYYMMDD / YYYYMMDD_HHMMSS timestamp from the full version string.
  // Assume the first instance of "-[0-9]{8}-", or "-[0-9]{8}_[0-9]{6}-" in case
  // LINEAGE_VERSION_APPEND_TIME_OF_DAY is set to true has the desired date.
  std::string ver = android::base::GetProperty("ro.lineage.version", "");
  std::smatch ver_date_match;
  std::regex_search(ver, ver_date_match, std::regex("-(\\d{8})-"));
  std::regex_search(ver, ver_date_match, std::regex("-(\\d{8}(_\\d{6})?)-"));
  std::string ver_date = ver_date_match.str(1);  // Empty if no match.

  std::vector<std::string> title_lines = {