summaryrefslogtreecommitdiffstats
path: root/updater/simulator_runtime.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-06-24 23:32:30 +0200
committerandroid-build-merger <android-build-merger@google.com>2019-06-24 23:32:30 +0200
commita2a500381a346bae7642448b30eff34dbd1deec4 (patch)
tree336f247c228ad303cc73f68635455a27cd46cb60 /updater/simulator_runtime.cpp
parentMerge "updater_sample: Build SystemUpdaterSample as non-privileged app by default." am: b87520077b (diff)
parentMerge "Implement updater runtime for dynamic partitions" (diff)
downloadandroid_bootable_recovery-a2a500381a346bae7642448b30eff34dbd1deec4.tar
android_bootable_recovery-a2a500381a346bae7642448b30eff34dbd1deec4.tar.gz
android_bootable_recovery-a2a500381a346bae7642448b30eff34dbd1deec4.tar.bz2
android_bootable_recovery-a2a500381a346bae7642448b30eff34dbd1deec4.tar.lz
android_bootable_recovery-a2a500381a346bae7642448b30eff34dbd1deec4.tar.xz
android_bootable_recovery-a2a500381a346bae7642448b30eff34dbd1deec4.tar.zst
android_bootable_recovery-a2a500381a346bae7642448b30eff34dbd1deec4.zip
Diffstat (limited to 'updater/simulator_runtime.cpp')
-rw-r--r--updater/simulator_runtime.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/updater/simulator_runtime.cpp b/updater/simulator_runtime.cpp
index c3b3d951c..c8718c71a 100644
--- a/updater/simulator_runtime.cpp
+++ b/updater/simulator_runtime.cpp
@@ -22,6 +22,8 @@
#include <sys/wait.h>
#include <unistd.h>
+#include <unordered_set>
+
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
@@ -95,3 +97,32 @@ bool SimulatorRuntime::WriteStringToFile(const std::string_view content,
LOG(INFO) << "SKip writing " << content.size() << " bytes to file " << filename;
return true;
}
+
+bool SimulatorRuntime::MapPartitionOnDeviceMapper(const std::string& partition_name,
+ std::string* path) {
+ *path = partition_name;
+ return true;
+}
+
+bool SimulatorRuntime::UnmapPartitionOnDeviceMapper(const std::string& partition_name) {
+ LOG(INFO) << "Skip unmapping " << partition_name;
+ return true;
+}
+
+bool SimulatorRuntime::UpdateDynamicPartitions(const std::string_view op_list_value) {
+ const std::unordered_set<std::string> commands{
+ "resize", "remove", "add", "move",
+ "add_group", "resize_group", "remove_group", "remove_all_groups",
+ };
+
+ std::vector<std::string> lines = android::base::Split(std::string(op_list_value), "\n");
+ for (const auto& line : lines) {
+ if (line.empty() || line[0] == '#') continue;
+ auto tokens = android::base::Split(line, " ");
+ if (commands.find(tokens[0]) == commands.end()) {
+ LOG(ERROR) << "Unknown operation in op_list: " << line;
+ return false;
+ }
+ }
+ return true;
+}