fastbootd: Unmount /cache before flashing.

Bug: 150112538
Test: fastboot flash cache on non-A/B device
Change-Id: I8a86bc4d12e4b3be020bbe47e02262a5aaa913a7
This commit is contained in:
David Anderson 2020-03-23 23:43:45 -07:00
parent 3ab681c9a8
commit 2ffc31b090
2 changed files with 14 additions and 2 deletions

View file

@ -31,6 +31,7 @@
#include <cutils/android_reboot.h>
#include <ext4_utils/wipe.h>
#include <fs_mgr.h>
#include <fs_mgr/roots.h>
#include <libgsi/libgsi.h>
#include <liblp/builder.h>
#include <liblp/liblp.h>

View file

@ -16,18 +16,22 @@
#include "fastboot_device.h"
#include <algorithm>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include <android/hardware/boot/1.0/IBootControl.h>
#include <android/hardware/fastboot/1.0/IFastboot.h>
#include <fs_mgr.h>
#include <fs_mgr/roots.h>
#include <healthhalutils/HealthHalUtils.h>
#include <algorithm>
#include "constants.h"
#include "flashing.h"
#include "usb_client.h"
using android::fs_mgr::EnsurePathUnmounted;
using android::fs_mgr::Fstab;
using ::android::hardware::hidl_string;
using ::android::hardware::boot::V1_0::IBootControl;
using ::android::hardware::boot::V1_0::Slot;
@ -64,6 +68,13 @@ FastbootDevice::FastbootDevice()
if (boot_control_hal_) {
boot1_1_ = android::hardware::boot::V1_1::IBootControl::castFrom(boot_control_hal_);
}
// Make sure cache is unmounted, since recovery will have mounted it for
// logging.
Fstab fstab;
if (ReadDefaultFstab(&fstab)) {
EnsurePathUnmounted(&fstab, "/cache");
}
}
FastbootDevice::~FastbootDevice() {