aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Astone <ales.astone@gmail.com>2019-07-25 23:35:14 +0200
committerLuca Stefani <luca.stefani.ge1@gmail.com>2019-07-26 23:27:05 +0200
commit6687a237f3c3a2493077596c49e803e364ae7d7c (patch)
tree64a2c80d98505b2a3b7b281c8f2217333b842c62
parent486c46730f36beb69d48b7a448e4fe68e5eb7b91 (diff)
downloadandroid_bootable_recovery-6687a237f3c3a2493077596c49e803e364ae7d7c.tar.gz
android_bootable_recovery-6687a237f3c3a2493077596c49e803e364ae7d7c.tar.bz2
android_bootable_recovery-6687a237f3c3a2493077596c49e803e364ae7d7c.zip
recovery: hide option to mount emulated storage after wiping data
* If userdata is initially unencrypted and user performs a wipe, the option to install from emulated storage would still be shown as available. * This patch sets userdata_mountable = false after wiping data. * That alone though is not enough, because if we reboot straight into recovery after wiping data, userdata_mountable will be true since "mounting" would indeed succeed, but no media/0 folder would be available. That is only created after booting system. To solve this we just add a check for mountability via the volume manager, which fails if it cannot bind-mount media/0 to /storage/emulated/0. Change-Id: Ia4a6f12db89bfbf21bbec38cc2f7b9598c8157a5
-rw-r--r--recovery.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/recovery.cpp b/recovery.cpp
index aec3a44b..a65aa338 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -927,6 +927,16 @@ static bool wipe_data(Device* device) {
if (success) {
success &= device->PostWipeData();
}
+
+ if (success) {
+ userdata_encrypted = false;
+ // At this point user data is theoretically mountable,
+ // but we're using vold to mount emulated storage
+ // and it requires /data/media/0 folder to exist,
+ // something that only Android should handle.
+ userdata_mountable = false;
+ }
+
ui->Print("Data wipe %s.\n", success ? "complete" : "failed");
return success;
}
@@ -1265,14 +1275,15 @@ refresh:
VolumeManager::Instance()->getVolumeInfo(volumes);
for (auto vol = volumes.begin(); vol != volumes.end(); /* empty */) {
+ if (!vol->mMountable) {
+ vol = volumes.erase(vol);
+ continue;
+ }
if (vol->mLabel == "emulated") {
if (!userdata_mountable || userdata_encrypted) {
vol = volumes.erase(vol);
continue;
}
- } else if (!vol->mMountable) {
- vol = volumes.erase(vol);
- continue;
}
items.push_back(MenuItem("Choose from " + vol->mLabel));