summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-05-24 06:45:43 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-05-24 06:45:43 +0200
commit52e61f699514dde119e8d4b1b4d2a3d7a9f7869c (patch)
treeb5d3c52ae588e83c2b26a762f01a796da2b5c73f
parentMerge "Move off the Next ZipString overload." (diff)
parentSome clean ups to the updater (diff)
downloadandroid_bootable_recovery-52e61f699514dde119e8d4b1b4d2a3d7a9f7869c.tar
android_bootable_recovery-52e61f699514dde119e8d4b1b4d2a3d7a9f7869c.tar.gz
android_bootable_recovery-52e61f699514dde119e8d4b1b4d2a3d7a9f7869c.tar.bz2
android_bootable_recovery-52e61f699514dde119e8d4b1b4d2a3d7a9f7869c.tar.lz
android_bootable_recovery-52e61f699514dde119e8d4b1b4d2a3d7a9f7869c.tar.xz
android_bootable_recovery-52e61f699514dde119e8d4b1b4d2a3d7a9f7869c.tar.zst
android_bootable_recovery-52e61f699514dde119e8d4b1b4d2a3d7a9f7869c.zip
Diffstat (limited to '')
-rw-r--r--tests/unit/updater_test.cpp4
-rw-r--r--updater/blockimg.cpp12
-rw-r--r--updater/include/updater/updater.h4
-rw-r--r--updater/include/updater/updater_runtime.h1
-rw-r--r--updater/install.cpp5
-rw-r--r--updater/updater.cpp4
6 files changed, 16 insertions, 14 deletions
diff --git a/tests/unit/updater_test.cpp b/tests/unit/updater_test.cpp
index 81229f50a..8993dd8b7 100644
--- a/tests/unit/updater_test.cpp
+++ b/tests/unit/updater_test.cpp
@@ -85,7 +85,7 @@ static void expect(const char* expected, const std::string& expr_str, CauseCode
}
static void expect(const char* expected, const std::string& expr_str, CauseCode cause_code) {
- Updater updater;
+ Updater updater(std::make_unique<UpdaterRuntime>(nullptr));
expect(expected, expr_str, cause_code, &updater);
}
@@ -133,6 +133,8 @@ static Value* BlobToString(const char* name, State* state,
class UpdaterTestBase {
protected:
+ UpdaterTestBase() : updater_(std::make_unique<UpdaterRuntime>(nullptr)) {}
+
void SetUp() {
RegisterBuiltins();
RegisterInstallFunctions();
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 55218b023..2d41f610b 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -49,7 +49,6 @@
#include <brotli/decode.h>
#include <fec/io.h>
#include <openssl/sha.h>
-#include <private/android_filesystem_config.h>
#include <verity/hash_tree_builder.h>
#include <ziparchive/zip_archive.h>
@@ -63,10 +62,15 @@
#include "private/commands.h"
#include "updater/install.h"
-// Set this to 0 to interpret 'erase' transfers to mean do a
-// BLKDISCARD ioctl (the normal behavior). Set to 1 to interpret
-// erase to mean fill the region with zeroes.
+#ifdef __ANDROID__
+#include <private/android_filesystem_config.h>
+// Set this to 0 to interpret 'erase' transfers to mean do a BLKDISCARD ioctl (the normal behavior).
+// Set to 1 to interpret erase to mean fill the region with zeroes.
#define DEBUG_ERASE 0
+#else
+#define DEBUG_ERASE 1
+#define AID_SYSTEM -1
+#endif // __ANDROID__
static constexpr size_t BLOCKSIZE = 4096;
static constexpr mode_t STASH_DIRECTORY_MODE = 0700;
diff --git a/updater/include/updater/updater.h b/updater/include/updater/updater.h
index 7bbecbc57..08816bf36 100644
--- a/updater/include/updater/updater.h
+++ b/updater/include/updater/updater.h
@@ -30,15 +30,11 @@
#include "otautil/error_code.h"
#include "otautil/sysutil.h"
-class UpdaterRuntime;
-
class Updater : public UpdaterInterface {
public:
explicit Updater(std::unique_ptr<UpdaterRuntimeInterface> run_time)
: runtime_(std::move(run_time)) {}
- Updater();
-
~Updater() override;
// Memory-maps the OTA package and opens it as a zip file. Also sets up the command pipe and
diff --git a/updater/include/updater/updater_runtime.h b/updater/include/updater/updater_runtime.h
index 6cd0ffb48..e97eb49b1 100644
--- a/updater/include/updater/updater_runtime.h
+++ b/updater/include/updater/updater_runtime.h
@@ -25,7 +25,6 @@
#include "edify/updater_runtime_interface.h"
struct selabel_handle;
-struct Partition;
class UpdaterRuntime : public UpdaterRuntimeInterface {
public:
diff --git a/updater/install.cpp b/updater/install.cpp
index 6b15eaa3a..c82351ec4 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -53,7 +53,6 @@
#include <openssl/sha.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
-#include <tune2fs.h>
#include <ziparchive/zip_archive.h>
#include "edify/expr.h"
@@ -65,6 +64,10 @@
#include "otautil/print_sha1.h"
#include "otautil/sysutil.h"
+#ifndef __ANDROID__
+#include <cutils/memory.h> // for strlcpy
+#endif
+
static bool UpdateBlockDeviceNameForPartition(UpdaterInterface* updater, Partition* partition) {
CHECK(updater);
std::string name = updater->FindBlockDeviceName(partition->name);
diff --git a/updater/updater.cpp b/updater/updater.cpp
index dbfa2f426..426c6dce0 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -24,9 +24,7 @@
#include <android-base/logging.h>
#include <android-base/strings.h>
-#include "updater/updater_runtime.h"
-
-Updater::Updater() : Updater(std::make_unique<UpdaterRuntime>(nullptr)) {}
+#include "edify/updater_runtime_interface.h"
Updater::~Updater() {
if (package_handle_) {