From cdb825e461182fd6cbea2583f200f40e14d923d9 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Mon, 18 Mar 2019 10:27:00 -0700 Subject: [PATCH] Check if we need to Poll for devices after RegenerateUevents If the required_devices_partition_names is cleared, no need to Poll. Test: manual check boot time, and adb-remount-test.sh Bug: 128834849 Change-Id: I044ee2752a7f32b084ff6e88b4b586accdfb78f0 --- init/first_stage_mount.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp index 17cd47077..4b0f05d4a 100644 --- a/init/first_stage_mount.cpp +++ b/init/first_stage_mount.cpp @@ -580,7 +580,14 @@ bool FirstStageMount::MountPartitions() { required_devices_partition_names_.emplace(basename(device.c_str())); auto uevent_callback = [this](const Uevent& uevent) { return UeventCallback(uevent); }; uevent_listener_.RegenerateUevents(uevent_callback); - uevent_listener_.Poll(uevent_callback, 10s); + if (!required_devices_partition_names_.empty()) { + uevent_listener_.Poll(uevent_callback, 10s); + if (!required_devices_partition_names_.empty()) { + LOG(ERROR) << __PRETTY_FUNCTION__ + << ": partition(s) not found after polling timeout: " + << android::base::Join(required_devices_partition_names_, ", "); + } + } } else { InitMappedDevice(device); }