Merge "Revert "mkbootimg: Build mkbootimg with Soong.""
diff --git a/fastboot/constants.h b/fastboot/constants.h
index 57e25fc..2a68a2b 100644
--- a/fastboot/constants.h
+++ b/fastboot/constants.h
@@ -32,6 +32,7 @@
#define FB_CMD_DELETE_PARTITION "delete-logical-partition"
#define FB_CMD_RESIZE_PARTITION "resize-logical-partition"
#define FB_CMD_UPDATE_SUPER "update-super"
+#define FB_CMD_OEM "oem"
#define RESPONSE_OKAY "OKAY"
#define RESPONSE_FAIL "FAIL"
diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp
index 0ec0994..48c935a 100644
--- a/fastboot/device/commands.cpp
+++ b/fastboot/device/commands.cpp
@@ -40,6 +40,9 @@
using ::android::hardware::boot::V1_0::BoolResult;
using ::android::hardware::boot::V1_0::CommandResult;
using ::android::hardware::boot::V1_0::Slot;
+using ::android::hardware::fastboot::V1_0::Result;
+using ::android::hardware::fastboot::V1_0::Status;
+
using namespace android::fs_mgr;
struct VariableHandlers {
@@ -133,6 +136,24 @@
return device->WriteStatus(FastbootResult::FAIL, "Erasing failed");
}
+bool OemCmdHandler(FastbootDevice* device, const std::vector<std::string>& args) {
+ auto fastboot_hal = device->fastboot_hal();
+ if (!fastboot_hal) {
+ return device->WriteStatus(FastbootResult::FAIL, "Unable to open fastboot HAL");
+ }
+
+ Result ret;
+ auto ret_val = fastboot_hal->doOemCommand(args[0], [&](Result result) { ret = result; });
+ if (!ret_val.isOk()) {
+ return device->WriteStatus(FastbootResult::FAIL, "Unable to do OEM command");
+ }
+ if (ret.status != Status::SUCCESS) {
+ return device->WriteStatus(FastbootResult::FAIL, ret.message);
+ }
+
+ return device->WriteStatus(FastbootResult::OKAY, ret.message);
+}
+
bool DownloadHandler(FastbootDevice* device, const std::vector<std::string>& args) {
if (args.size() < 2) {
return device->WriteStatus(FastbootResult::FAIL, "size argument unspecified");
diff --git a/fastboot/device/commands.h b/fastboot/device/commands.h
index 4778d23..9df43a9 100644
--- a/fastboot/device/commands.h
+++ b/fastboot/device/commands.h
@@ -45,3 +45,4 @@
bool DeletePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args);
bool ResizePartitionHandler(FastbootDevice* device, const std::vector<std::string>& args);
bool UpdateSuperHandler(FastbootDevice* device, const std::vector<std::string>& args);
+bool OemCmdHandler(FastbootDevice* device, const std::vector<std::string>& args);
diff --git a/fastboot/device/fastboot_device.cpp b/fastboot/device/fastboot_device.cpp
index ae2e7a6..6862741 100644
--- a/fastboot/device/fastboot_device.cpp
+++ b/fastboot/device/fastboot_device.cpp
@@ -48,6 +48,7 @@
{FB_CMD_DELETE_PARTITION, DeletePartitionHandler},
{FB_CMD_RESIZE_PARTITION, ResizePartitionHandler},
{FB_CMD_UPDATE_SUPER, UpdateSuperHandler},
+ {FB_CMD_OEM, OemCmdHandler},
}),
transport_(std::make_unique<ClientUsbTransport>()),
boot_control_hal_(IBootControl::getService()),
@@ -120,10 +121,20 @@
command[bytes_read] = '\0';
LOG(INFO) << "Fastboot command: " << command;
- auto args = android::base::Split(command, ":");
- auto found_command = kCommandMap.find(args[0]);
+
+ std::vector<std::string> args;
+ std::string cmd_name;
+ if (android::base::StartsWith(command, "oem ")) {
+ args = {command};
+ cmd_name = "oem";
+ } else {
+ args = android::base::Split(command, ":");
+ cmd_name = args[0];
+ }
+
+ auto found_command = kCommandMap.find(cmd_name);
if (found_command == kCommandMap.end()) {
- WriteStatus(FastbootResult::FAIL, "Unrecognized command");
+ WriteStatus(FastbootResult::FAIL, "Unrecognized command " + args[0]);
continue;
}
if (!found_command->second(this, args)) {
diff --git a/init/init.cpp b/init/init.cpp
index e5c1548..47cfe32 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -346,12 +346,12 @@
if (!android::base::GetBoolProperty("ro.oem_unlock_supported", false)) {
return;
}
-
- std::string value = GetProperty("ro.boot.verifiedbootstate", "");
-
- if (!value.empty()) {
- property_set("ro.boot.flash.locked", value == "orange" ? "0" : "1");
- }
+ import_kernel_cmdline(
+ false, [](const std::string& key, const std::string& value, bool in_qemu) {
+ if (key == "androidboot.verifiedbootstate") {
+ property_set("ro.boot.flash.locked", value == "orange" ? "0" : "1");
+ }
+ });
}
static void export_kernel_boot_props() {
diff --git a/libgrallocusage/Android.bp b/libgrallocusage/Android.bp
index bcc0616..d27feb9 100644
--- a/libgrallocusage/Android.bp
+++ b/libgrallocusage/Android.bp
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-cc_library_static {
+cc_library {
name: "libgrallocusage",
vendor_available: true,
cflags: [
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 915540e..f39ea7c 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -407,6 +407,9 @@
mkdir /data/bootchart 0755 shell shell
bootchart start
+ # Start apexd as soon as we can
+ start apexd
+
# Avoid predictable entropy pool. Carry over entropy from previous boot.
copy /data/system/entropy.dat /dev/urandom