Revert "Fixed readUserListLP() so it recovers when user 0 data is corrupted."

This reverts commit bede7f6a9c.

Reason for revert: the current fix fallbacks to single user, which would remove all secondary users (which in turn are the "real" users on automotive). A better approach would be just re-creating user 0 and leaving others alone (perhaps even configuring this behavior using a config boolean); I'll try that later...

Bug: 159350797
Change-Id: I259725936ce35fc94e0a1eb3f26f7efcd4b31b33
Test: N/A
This commit is contained in:
Felipe Leme
2020-06-23 16:19:50 +00:00
parent bede7f6a9c
commit f41d02fa92

View File

@@ -2528,12 +2528,7 @@ public class UserManagerService extends IUserManager.Stub {
if (name.equals(TAG_USER)) {
String id = parser.getAttributeValue(null, ATTR_ID);
int userId = Integer.parseInt(id);
UserData userData = readUserLP(userId);
if (userData == null && userId == UserHandle.USER_SYSTEM) {
fallbackToSingleUserLP();
return;
}
UserData userData = readUserLP(Integer.parseInt(id));
if (userData != null) {
synchronized (mUsersLock) {
@@ -2999,8 +2994,10 @@ public class UserManagerService extends IUserManager.Stub {
new AtomicFile(new File(mUsersDir, Integer.toString(id) + XML_SUFFIX));
fis = userFile.openRead();
return readUserLP(id, fis);
} catch (IOException | XmlPullParserException e) {
Slog.e(LOG_TAG, "Error reading user " + id + ": " + e);
} catch (IOException ioe) {
Slog.e(LOG_TAG, "Error reading user list");
} catch (XmlPullParserException pe) {
Slog.e(LOG_TAG, "Error reading user list");
} finally {
IoUtils.closeQuietly(fis);
}