Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "variables.h" |
| 18 | |
David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 19 | #include <inttypes.h> |
| 20 | |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 21 | #include <android-base/file.h> |
| 22 | #include <android-base/logging.h> |
| 23 | #include <android-base/properties.h> |
| 24 | #include <android-base/stringprintf.h> |
| 25 | #include <android-base/strings.h> |
| 26 | #include <ext4_utils/ext4_utils.h> |
| 27 | |
| 28 | #include "fastboot_device.h" |
David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 29 | #include "flashing.h" |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 30 | #include "utility.h" |
| 31 | |
| 32 | using ::android::hardware::boot::V1_0::BoolResult; |
| 33 | using ::android::hardware::boot::V1_0::Slot; |
Hridya Valsaraju | bf9f8d1 | 2018-09-05 16:57:24 -0700 | [diff] [blame] | 34 | using ::android::hardware::fastboot::V1_0::FileSystemType; |
| 35 | using ::android::hardware::fastboot::V1_0::Result; |
| 36 | using ::android::hardware::fastboot::V1_0::Status; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 37 | |
| 38 | constexpr int kMaxDownloadSizeDefault = 0x20000000; |
| 39 | constexpr char kFastbootProtocolVersion[] = "0.4"; |
| 40 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 41 | bool GetVersion(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 42 | std::string* message) { |
| 43 | *message = kFastbootProtocolVersion; |
| 44 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 45 | } |
| 46 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 47 | bool GetBootloaderVersion(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 48 | std::string* message) { |
| 49 | *message = android::base::GetProperty("ro.bootloader", ""); |
| 50 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 51 | } |
| 52 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 53 | bool GetBasebandVersion(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 54 | std::string* message) { |
| 55 | *message = android::base::GetProperty("ro.build.expect.baseband", ""); |
| 56 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 57 | } |
| 58 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 59 | bool GetProduct(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 60 | std::string* message) { |
| 61 | *message = android::base::GetProperty("ro.product.device", ""); |
| 62 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 63 | } |
| 64 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 65 | bool GetSerial(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 66 | std::string* message) { |
| 67 | *message = android::base::GetProperty("ro.serialno", ""); |
| 68 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 69 | } |
| 70 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 71 | bool GetSecure(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 72 | std::string* message) { |
| 73 | *message = android::base::GetBoolProperty("ro.secure", "") ? "yes" : "no"; |
| 74 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 75 | } |
| 76 | |
Hridya Valsaraju | 4af8090 | 2018-09-26 13:08:16 -0700 | [diff] [blame] | 77 | bool GetVariant(FastbootDevice* device, const std::vector<std::string>& /* args */, |
| 78 | std::string* message) { |
| 79 | auto fastboot_hal = device->fastboot_hal(); |
| 80 | if (!fastboot_hal) { |
| 81 | *message = "Fastboot HAL not found"; |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | Result ret; |
| 86 | auto ret_val = fastboot_hal->getVariant([&](std::string device_variant, Result result) { |
| 87 | *message = device_variant; |
| 88 | ret = result; |
| 89 | }); |
| 90 | if (!ret_val.isOk() || ret.status != Status::SUCCESS) { |
| 91 | *message = "Unable to get device variant"; |
| 92 | return false; |
| 93 | } |
| 94 | |
| 95 | return true; |
| 96 | } |
| 97 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 98 | bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */, |
| 99 | std::string* message) { |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 100 | std::string suffix = device->GetCurrentSlot(); |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 101 | *message = suffix.size() == 2 ? suffix.substr(1) : suffix; |
| 102 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 103 | } |
| 104 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 105 | bool GetSlotCount(FastbootDevice* device, const std::vector<std::string>& /* args */, |
| 106 | std::string* message) { |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 107 | auto boot_control_hal = device->boot_control_hal(); |
| 108 | if (!boot_control_hal) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 109 | *message = "0"; |
| 110 | } else { |
| 111 | *message = std::to_string(boot_control_hal->getNumberSlots()); |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 112 | } |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 113 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 114 | } |
| 115 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 116 | bool GetSlotSuccessful(FastbootDevice* device, const std::vector<std::string>& args, |
| 117 | std::string* message) { |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 118 | if (args.empty()) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 119 | *message = "Missing argument"; |
| 120 | return false; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 121 | } |
| 122 | Slot slot; |
| 123 | if (!GetSlotNumber(args[0], &slot)) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 124 | *message = "Invalid slot"; |
| 125 | return false; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 126 | } |
| 127 | auto boot_control_hal = device->boot_control_hal(); |
| 128 | if (!boot_control_hal) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 129 | *message = "Device has no slots"; |
| 130 | return false; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 131 | } |
David Anderson | 856b7ec | 2018-08-08 17:58:56 -0700 | [diff] [blame] | 132 | if (boot_control_hal->isSlotMarkedSuccessful(slot) != BoolResult::TRUE) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 133 | *message = "no"; |
| 134 | } else { |
| 135 | *message = "yes"; |
David Anderson | 856b7ec | 2018-08-08 17:58:56 -0700 | [diff] [blame] | 136 | } |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 137 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 138 | } |
| 139 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 140 | bool GetSlotUnbootable(FastbootDevice* device, const std::vector<std::string>& args, |
| 141 | std::string* message) { |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 142 | if (args.empty()) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 143 | *message = "Missing argument"; |
| 144 | return false; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 145 | } |
| 146 | Slot slot; |
| 147 | if (!GetSlotNumber(args[0], &slot)) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 148 | *message = "Invalid slot"; |
| 149 | return false; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 150 | } |
| 151 | auto boot_control_hal = device->boot_control_hal(); |
| 152 | if (!boot_control_hal) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 153 | *message = "Device has no slots"; |
| 154 | return false; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 155 | } |
David Anderson | 856b7ec | 2018-08-08 17:58:56 -0700 | [diff] [blame] | 156 | if (boot_control_hal->isSlotBootable(slot) != BoolResult::TRUE) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 157 | *message = "yes"; |
| 158 | } else { |
| 159 | *message = "no"; |
David Anderson | 856b7ec | 2018-08-08 17:58:56 -0700 | [diff] [blame] | 160 | } |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 161 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 162 | } |
| 163 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 164 | bool GetMaxDownloadSize(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 165 | std::string* message) { |
David Anderson | 28b81cd | 2018-09-04 16:51:29 -0700 | [diff] [blame] | 166 | *message = android::base::StringPrintf("0x%X", kMaxDownloadSizeDefault); |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 167 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 168 | } |
| 169 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 170 | bool GetUnlocked(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 171 | std::string* message) { |
Hridya Valsaraju | dca328d | 2018-09-24 16:01:35 -0700 | [diff] [blame] | 172 | *message = GetDeviceLockStatus() ? "no" : "yes"; |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 173 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 174 | } |
| 175 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 176 | bool GetHasSlot(FastbootDevice* device, const std::vector<std::string>& args, |
| 177 | std::string* message) { |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 178 | if (args.empty()) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 179 | *message = "Missing argument"; |
| 180 | return false; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 181 | } |
| 182 | std::string slot_suffix = device->GetCurrentSlot(); |
| 183 | if (slot_suffix.empty()) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 184 | *message = "no"; |
| 185 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 186 | } |
David Anderson | 79ab0e3 | 2018-08-14 16:21:50 -0700 | [diff] [blame] | 187 | std::string partition_name = args[0] + slot_suffix; |
| 188 | if (FindPhysicalPartition(partition_name) || |
| 189 | LogicalPartitionExists(partition_name, slot_suffix)) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 190 | *message = "yes"; |
| 191 | } else { |
| 192 | *message = "no"; |
David Anderson | 79ab0e3 | 2018-08-14 16:21:50 -0700 | [diff] [blame] | 193 | } |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 194 | return true; |
Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 195 | } |
David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 196 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 197 | bool GetPartitionSize(FastbootDevice* device, const std::vector<std::string>& args, |
| 198 | std::string* message) { |
David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 199 | if (args.size() < 1) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 200 | *message = "Missing argument"; |
| 201 | return false; |
David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 202 | } |
David Anderson | 88ef0b1 | 2018-08-09 10:40:00 -0700 | [diff] [blame] | 203 | // Zero-length partitions cannot be created through device-mapper, so we |
| 204 | // special case them here. |
| 205 | bool is_zero_length; |
| 206 | if (LogicalPartitionExists(args[0], device->GetCurrentSlot(), &is_zero_length) && |
| 207 | is_zero_length) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 208 | *message = "0"; |
| 209 | return true; |
David Anderson | 88ef0b1 | 2018-08-09 10:40:00 -0700 | [diff] [blame] | 210 | } |
| 211 | // Otherwise, open the partition as normal. |
David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 212 | PartitionHandle handle; |
| 213 | if (!OpenPartition(device, args[0], &handle)) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 214 | *message = "Could not open partition"; |
| 215 | return false; |
David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 216 | } |
| 217 | uint64_t size = get_block_device_size(handle.fd()); |
David Anderson | 4758967 | 2018-09-04 16:22:41 -0700 | [diff] [blame] | 218 | *message = android::base::StringPrintf("0x%" PRIX64, size); |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 219 | return true; |
David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 220 | } |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 221 | |
Hridya Valsaraju | bf9f8d1 | 2018-09-05 16:57:24 -0700 | [diff] [blame] | 222 | bool GetPartitionType(FastbootDevice* device, const std::vector<std::string>& args, |
| 223 | std::string* message) { |
| 224 | if (args.size() < 1) { |
| 225 | *message = "Missing argument"; |
| 226 | return false; |
| 227 | } |
| 228 | std::string partition_name = args[0]; |
| 229 | auto fastboot_hal = device->fastboot_hal(); |
| 230 | if (!fastboot_hal) { |
| 231 | *message = "Fastboot HAL not found"; |
| 232 | return false; |
| 233 | } |
| 234 | |
| 235 | FileSystemType type; |
| 236 | Result ret; |
| 237 | auto ret_val = |
| 238 | fastboot_hal->getPartitionType(args[0], [&](FileSystemType fs_type, Result result) { |
| 239 | type = fs_type; |
| 240 | ret = result; |
| 241 | }); |
| 242 | if (!ret_val.isOk() || (ret.status != Status::SUCCESS)) { |
| 243 | *message = "Unable to retrieve partition type"; |
| 244 | } else { |
| 245 | switch (type) { |
| 246 | case FileSystemType::RAW: |
| 247 | *message = "raw"; |
| 248 | return true; |
| 249 | case FileSystemType::EXT4: |
| 250 | *message = "ext4"; |
| 251 | return true; |
| 252 | case FileSystemType::F2FS: |
| 253 | *message = "f2fs"; |
| 254 | return true; |
| 255 | default: |
| 256 | *message = "Unknown file system type"; |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | return false; |
| 261 | } |
| 262 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 263 | bool GetPartitionIsLogical(FastbootDevice* device, const std::vector<std::string>& args, |
| 264 | std::string* message) { |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 265 | if (args.size() < 1) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 266 | *message = "Missing argument"; |
| 267 | return false; |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 268 | } |
| 269 | // Note: if a partition name is in both the GPT and the super partition, we |
| 270 | // return "true", to be consistent with prefering to flash logical partitions |
| 271 | // over physical ones. |
| 272 | std::string partition_name = args[0]; |
| 273 | if (LogicalPartitionExists(partition_name, device->GetCurrentSlot())) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 274 | *message = "yes"; |
| 275 | return true; |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 276 | } |
| 277 | if (FindPhysicalPartition(partition_name)) { |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 278 | *message = "no"; |
| 279 | return true; |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 280 | } |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 281 | *message = "Partition not found"; |
| 282 | return false; |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 283 | } |
David Anderson | d9ba061 | 2018-08-02 11:05:00 -0700 | [diff] [blame] | 284 | |
David Anderson | 1fb3fd7 | 2018-08-31 14:40:22 -0700 | [diff] [blame] | 285 | bool GetIsUserspace(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 286 | std::string* message) { |
| 287 | *message = "yes"; |
| 288 | return true; |
David Anderson | d9ba061 | 2018-08-02 11:05:00 -0700 | [diff] [blame] | 289 | } |
David Anderson | 0f62663 | 2018-08-31 16:44:25 -0700 | [diff] [blame] | 290 | |
| 291 | std::vector<std::vector<std::string>> GetAllPartitionArgsWithSlot(FastbootDevice* device) { |
| 292 | std::vector<std::vector<std::string>> args; |
| 293 | auto partitions = ListPartitions(device); |
| 294 | for (const auto& partition : partitions) { |
| 295 | args.emplace_back(std::initializer_list<std::string>{partition}); |
| 296 | } |
| 297 | return args; |
| 298 | } |
| 299 | |
| 300 | std::vector<std::vector<std::string>> GetAllPartitionArgsNoSlot(FastbootDevice* device) { |
| 301 | auto partitions = ListPartitions(device); |
| 302 | |
| 303 | std::string slot_suffix = device->GetCurrentSlot(); |
| 304 | if (!slot_suffix.empty()) { |
| 305 | auto names = std::move(partitions); |
| 306 | for (const auto& name : names) { |
| 307 | std::string slotless_name = name; |
| 308 | if (android::base::EndsWith(name, "_a") || android::base::EndsWith(name, "_b")) { |
| 309 | slotless_name = name.substr(0, name.rfind("_")); |
| 310 | } |
| 311 | if (std::find(partitions.begin(), partitions.end(), slotless_name) == |
| 312 | partitions.end()) { |
| 313 | partitions.emplace_back(slotless_name); |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | std::vector<std::vector<std::string>> args; |
| 319 | for (const auto& partition : partitions) { |
| 320 | args.emplace_back(std::initializer_list<std::string>{partition}); |
| 321 | } |
| 322 | return args; |
| 323 | } |
David Anderson | c091c17 | 2018-09-04 18:11:03 -0700 | [diff] [blame] | 324 | |
| 325 | bool GetHardwareRevision(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, |
| 326 | std::string* message) { |
| 327 | *message = android::base::GetProperty("ro.revision", ""); |
| 328 | return true; |
| 329 | } |