partitionmanager: support delayed adopted storage mount

* On some devices, the external mmc driver will only load the card after
  a certain delay. The original code will break and fail to mount any
  adopted storage in this case.

* Add a special fstab flag to allow the partitionmanager to retry after
  a delay.

Change-Id: I219978850ff3ba7ad9dc7ca96fc30634c9574164
This commit is contained in:
Peter Cai
2019-10-17 08:49:10 +08:00
committed by bigbiff
parent 8d7d4aed04
commit 439d60cb9d
3 changed files with 17 additions and 0 deletions
+10
View File
@@ -2959,6 +2959,16 @@ bool TWPartitionManager::Decrypt_Adopted() {
}
std::vector<TWPartition*>::iterator adopt;
for (adopt = Partitions.begin(); adopt != Partitions.end(); adopt++) {
if ((*adopt)->Removable && !(*adopt)->Is_Present && (*adopt)->Adopted_Mount_Delay > 0) {
// On some devices, the external mmc driver takes some time
// to recognize the card, in which case the "actual block device"
// would not have been found yet. We wait the specified delay
// and then try again.
LOGINFO("Sleeping %d seconds for adopted storage.\n", (*adopt)->Adopted_Mount_Delay);
sleep((*adopt)->Adopted_Mount_Delay);
(*adopt)->Find_Actual_Block_Device();
}
if ((*adopt)->Removable && (*adopt)->Is_Present) {
if ((*adopt)->Decrypt_Adopted() == 0) {
ret = true;