diff --git a/fs_mgr/libdm/dm.cpp b/fs_mgr/libdm/dm.cpp index 673e145f1..791268849 100644 --- a/fs_mgr/libdm/dm.cpp +++ b/fs_mgr/libdm/dm.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -140,6 +141,10 @@ static std::string GenerateUuid() { return std::string{uuid_chars}; } +static bool IsRecovery() { + return access("/system/bin/recovery", F_OK) == 0; +} + bool DeviceMapper::CreateDevice(const std::string& name, const DmTable& table, std::string* path, const std::chrono::milliseconds& timeout_ms) { std::string uuid = GenerateUuid(); @@ -160,6 +165,16 @@ bool DeviceMapper::CreateDevice(const std::string& name, const DmTable& table, s if (timeout_ms <= std::chrono::milliseconds::zero()) { return true; } + + if (IsRecovery()) { + bool non_ab_device = android::base::GetProperty("ro.build.ab_update", "").empty(); + int sdk = android::base::GetIntProperty("ro.build.version.sdk", 0); + if (non_ab_device && sdk && sdk <= 29) { + LOG(INFO) << "Detected ueventd incompatibility, reverting to legacy libdm behavior."; + unique_path = *path; + } + } + if (!WaitForFile(unique_path, timeout_ms)) { LOG(ERROR) << "Failed waiting for device path: " << unique_path; DeleteDevice(name); diff --git a/init/reboot.cpp b/init/reboot.cpp index ffd58a38d..23a07aa64 100644 --- a/init/reboot.cpp +++ b/init/reboot.cpp @@ -678,9 +678,12 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str // Reap subcontext pids. ReapAnyOutstandingChildren(); - // 3. send volume shutdown to vold + // 3. send volume abort_fuse and volume shutdown to vold Service* vold_service = ServiceList::GetInstance().FindService("vold"); if (vold_service != nullptr && vold_service->IsRunning()) { + // Manually abort FUSE connections, since the FUSE daemon is already dead + // at this point, and unmounting it might hang. + CallVdc("volume", "abort_fuse"); CallVdc("volume", "shutdown"); vold_service->Stop(); } else { diff --git a/libstats/pull/stats_pull_atom_callback.cpp b/libstats/pull/stats_pull_atom_callback.cpp index 2d184bd2d..0b9dd5292 100644 --- a/libstats/pull/stats_pull_atom_callback.cpp +++ b/libstats/pull/stats_pull_atom_callback.cpp @@ -47,7 +47,7 @@ AStatsEvent* AStatsEventList_addStatsEvent(AStatsEventList* pull_data) { } static const int64_t DEFAULT_COOL_DOWN_MILLIS = 1000LL; // 1 second. -static const int64_t DEFAULT_TIMEOUT_MILLIS = 10000LL; // 10 seconds. +static const int64_t DEFAULT_TIMEOUT_MILLIS = 2000LL; // 2 seconds. struct AStatsManager_PullAtomMetadata { int64_t cool_down_millis; diff --git a/libstats/pull/tests/pull_atom_metadata_test.cpp b/libstats/pull/tests/pull_atom_metadata_test.cpp index cf1930357..abc8e47af 100644 --- a/libstats/pull/tests/pull_atom_metadata_test.cpp +++ b/libstats/pull/tests/pull_atom_metadata_test.cpp @@ -21,7 +21,7 @@ namespace { static const int64_t DEFAULT_COOL_DOWN_MILLIS = 1000LL; // 1 second. -static const int64_t DEFAULT_TIMEOUT_MILLIS = 10000LL; // 10 seconds. +static const int64_t DEFAULT_TIMEOUT_MILLIS = 2000LL; // 2 seconds. } // anonymous namespace diff --git a/rootdir/init.rc b/rootdir/init.rc index 38ba137e7..2d6719468 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -177,6 +177,9 @@ on init mount binder binder /dev/binderfs stats=global chmod 0755 /dev/binderfs + # Mount fusectl + mount fusectl none /sys/fs/fuse/connections + symlink /dev/binderfs/binder /dev/binder symlink /dev/binderfs/hwbinder /dev/hwbinder symlink /dev/binderfs/vndbinder /dev/vndbinder diff --git a/rootdir/init.zygote32.rc b/rootdir/init.zygote32.rc index 9adbcba2e..e827cf557 100644 --- a/rootdir/init.zygote32.rc +++ b/rootdir/init.zygote32.rc @@ -5,6 +5,7 @@ service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-sys group root readproc reserved_disk socket zygote stream 660 root system socket usap_pool_primary stream 660 root system + onrestart exec_background - system system -- /system/bin/vdc volume abort_fuse onrestart write /sys/power/state on onrestart restart audioserver onrestart restart cameraserver diff --git a/rootdir/init.zygote32_64.rc b/rootdir/init.zygote32_64.rc index f6149c921..fe6dcfa47 100644 --- a/rootdir/init.zygote32_64.rc +++ b/rootdir/init.zygote32_64.rc @@ -5,6 +5,7 @@ service zygote /system/bin/app_process32 -Xzygote /system/bin --zygote --start-s group root readproc reserved_disk socket zygote stream 660 root system socket usap_pool_primary stream 660 root system + onrestart exec_background - system system -- /system/bin/vdc volume abort_fuse onrestart write /sys/power/state on onrestart restart audioserver onrestart restart cameraserver diff --git a/rootdir/init.zygote64.rc b/rootdir/init.zygote64.rc index 0e69b1695..adc703102 100644 --- a/rootdir/init.zygote64.rc +++ b/rootdir/init.zygote64.rc @@ -5,6 +5,7 @@ service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-s group root readproc reserved_disk socket zygote stream 660 root system socket usap_pool_primary stream 660 root system + onrestart exec_background - system system -- /system/bin/vdc volume abort_fuse onrestart write /sys/power/state on onrestart restart audioserver onrestart restart cameraserver diff --git a/rootdir/init.zygote64_32.rc b/rootdir/init.zygote64_32.rc index 3e8016867..70297484a 100644 --- a/rootdir/init.zygote64_32.rc +++ b/rootdir/init.zygote64_32.rc @@ -5,6 +5,7 @@ service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-s group root readproc reserved_disk socket zygote stream 660 root system socket usap_pool_primary stream 660 root system + onrestart exec_background - system system -- /system/bin/vdc volume abort_fuse onrestart write /sys/power/state on onrestart restart audioserver onrestart restart cameraserver