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

Commit 04dec0ff authored by Steve Kondik's avatar Steve Kondik Committed by Tom Marshall
Browse files

sr: Add performance control

 * Crank it up when installing

Change-Id: I997d937901ff446834e6c479aaf629bee51de388
parent 59f17e71
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -175,11 +175,14 @@ void stop_sideload() {
}

int wait_sideload() {
  set_perf_mode(true);
  pthread_join(sideload_thread, nullptr);

  ui->FlushKeys();

  maybe_restart_adbd();

  set_perf_mode(false);

  return sideload_data.result;
}
+11 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@
#include <vintf/VintfObjectRecovery.h>
#include <ziparchive/zip_archive.h>

#include <cutils/properties.h>

#include "common.h"
#include "error_code.h"
#include "otautil/SysUtil.h"
@@ -601,8 +603,10 @@ static int really_install_package(std::string path, bool* wipe_cache, bool needs
  }

  // Verify package.
  set_perf_mode(true);
  if (!verify_package(map.addr, map.length)) {
    log_buffer->push_back(android::base::StringPrintf("error: %d", kZipVerificationFailure));
    set_perf_mode(false);
    return INSTALL_CORRUPT;
  }

@@ -614,6 +618,7 @@ static int really_install_package(std::string path, bool* wipe_cache, bool needs
    log_buffer->push_back(android::base::StringPrintf("error: %d", kZipOpenFailure));

    CloseArchive(zip);
    set_perf_mode(false);
    return INSTALL_CORRUPT;
  }

@@ -635,6 +640,7 @@ static int really_install_package(std::string path, bool* wipe_cache, bool needs
  ui->Print("\n");

  CloseArchive(zip);
  set_perf_mode(false);
  return result;
}

@@ -748,3 +754,8 @@ bool verify_package(const unsigned char* package_data, size_t package_size) {
  }
  return true;
}

void
set_perf_mode(bool enable) {
    property_set("recovery.perf.mode", enable ? "1" : "0");
}
+2 −0
Original line number Diff line number Diff line
@@ -40,4 +40,6 @@ bool read_metadata_from_package(ZipArchiveHandle zip, std::string* metadata);
// entry doesn't exist.
bool verify_package_compatibility(ZipArchiveHandle package_zip);

void set_perf_mode(bool enable);

#endif  // RECOVERY_INSTALL_H_