UserDataPreparer: reboot to recovery for system user only
With the next CL, old devices might contain a combination of old users with prepareUserStorage error checking disabled and new users with prepareUserStorage error checking enabled. Factory resetting the whole device when any user fails to prepare may be too aggressive. Also, UserDataPreparer already destroys the affected user's storage when it fails to prepare, which seems to be fairly effective at breaking things for that user (absent proper error handling by upper layers). Therefore, let's only factory reset the device if the failing user is the system user. Bug: 164488924 Bug: 216025819 Change-Id: Ia1db01ab4ec6b3b17d725f391c3500d92aa00f97
This commit is contained in:
@@ -118,8 +118,11 @@ class UserDataPreparer {
|
||||
flags | StorageManager.FLAG_STORAGE_DE, false);
|
||||
} else {
|
||||
try {
|
||||
Log.e(TAG, "prepareUserData failed", e);
|
||||
RecoverySystem.rebootPromptAndWipeUserData(mContext, "prepareUserData failed");
|
||||
Log.wtf(TAG, "prepareUserData failed for user " + userId, e);
|
||||
if (userId == UserHandle.USER_SYSTEM) {
|
||||
RecoverySystem.rebootPromptAndWipeUserData(mContext,
|
||||
"prepareUserData failed for system user");
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
throw new RuntimeException("error rebooting into recovery", e2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user