From cb1d0d90afe152012ed0c425f965ea14a91a5a45 Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Mon, 9 Nov 2020 17:45:35 +0800 Subject: [PATCH] Use default DSU slot name when active DSU is empty If host system is Android Q and guest system is S, then reenable DSU in the guest system (`adb shell gsi_tool enable -s`) would create an empty DSU active indicator file. In this case, use the default slot name "DSU" if DSU active indicator file is non-existent or empty. Bug: 172541102 Bug: 168571434 Test: Boot GSI S on Pixel Q with DSU Test: Verify reenable DSU works Test: adb shell gsi_tool enable -s && adb reboot Change-Id: Ie59e4378d1aa4dca085c399a75abd4e662340030 --- fs_mgr/fs_mgr_fstab.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 4b7946657..42459ec9c 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -692,14 +692,18 @@ bool ReadFstabFromFile(const std::string& path, Fstab* fstab) { return false; } if (!is_proc_mounts && !access(android::gsi::kGsiBootedIndicatorFile, F_OK)) { + // This is expected to fail if host is android Q, since Q doesn't + // support DSU slotting. The DSU "active" indicator file would be + // non-existent or empty if DSU is enabled within the guest system. + // In that case, just use the default slot name "dsu". std::string dsu_slot; if (!android::gsi::GetActiveDsu(&dsu_slot)) { - // This is expected to fail if host is android Q, since Q doesn't - // support DSU slotting. - // In that case, just use the default slot name "dsu". PWARNING << __FUNCTION__ << "(): failed to get active dsu slot"; + } + if (dsu_slot.empty()) { dsu_slot = "dsu"; } + std::string lp_names; ReadFileToString(gsi::kGsiLpNamesFile, &lp_names); TransformFstabForDsu(fstab, dsu_slot, Split(lp_names, ","));