Merge "UserDataPreparer: reboot to recovery if preparing user storage fails" am: 39d90b7a2d am: 0a3cb5df0a am: e68cd4c435
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1959659 Change-Id: I270cf463e798f834bbc278bdc1742f623b44d831
This commit is contained in:
@@ -22,6 +22,7 @@ import android.content.Context;
|
|||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.FileUtils;
|
import android.os.FileUtils;
|
||||||
|
import android.os.RecoverySystem;
|
||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.os.storage.VolumeInfo;
|
import android.os.storage.VolumeInfo;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
@@ -115,6 +116,13 @@ class UserDataPreparer {
|
|||||||
// Try one last time; if we fail again we're really in trouble
|
// Try one last time; if we fail again we're really in trouble
|
||||||
prepareUserDataLI(volumeUuid, userId, userSerial,
|
prepareUserDataLI(volumeUuid, userId, userSerial,
|
||||||
flags | StorageManager.FLAG_STORAGE_DE, false);
|
flags | StorageManager.FLAG_STORAGE_DE, false);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Log.e(TAG, "prepareUserData failed", e);
|
||||||
|
RecoverySystem.rebootPromptAndWipeUserData(mContext, "prepareUserData failed");
|
||||||
|
} catch (IOException e2) {
|
||||||
|
throw new RuntimeException("error rebooting into recovery", e2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user