Add UpdaterRuntime class

This class adds a wrapper to the runtime dependent functions. Therefore,
the behavior of update on device stays the same, while simulators can
have their own implementations. Also change the caller side of the
registered updater functions to call these runtime wrappers.

Bug: 131911365
Test: unit tests pass, sideload an update on cuttlefish
Change-Id: Ib3ab67132991d67fc132f27120e4152439d16ac5
This commit is contained in:
Tianjie Xu
2019-05-20 18:03:27 -07:00
parent e7a0262c14
commit 1536db887f
13 changed files with 486 additions and 164 deletions
+2 -2
View File
@@ -421,5 +421,5 @@ Value* ErrorAbort(State* state, CauseCode cause_code, const char* format, ...) {
return nullptr;
}
State::State(const std::string& script, void* cookie)
: script(script), cookie(cookie), error_code(kNoError), cause_code(kNoCause) {}
State::State(const std::string& script, UpdaterInterface* interface)
: script(script), updater(interface), error_code(kNoError), cause_code(kNoCause) {}