Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f41d02fa authored by Felipe Leme's avatar Felipe Leme
Browse files

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

This reverts commit bede7f6a.

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
parent bede7f6a
Loading
Loading
Loading
Loading
+5 −8
Original line number Original line Diff line number Diff line
@@ -2528,12 +2528,7 @@ public class UserManagerService extends IUserManager.Stub {
                    if (name.equals(TAG_USER)) {
                    if (name.equals(TAG_USER)) {
                        String id = parser.getAttributeValue(null, ATTR_ID);
                        String id = parser.getAttributeValue(null, ATTR_ID);


                        int userId = Integer.parseInt(id);
                        UserData userData = readUserLP(Integer.parseInt(id));
                        UserData userData = readUserLP(userId);
                        if (userData == null && userId == UserHandle.USER_SYSTEM) {
                            fallbackToSingleUserLP();
                            return;
                        }


                        if (userData != null) {
                        if (userData != null) {
                            synchronized (mUsersLock) {
                            synchronized (mUsersLock) {
@@ -2999,8 +2994,10 @@ public class UserManagerService extends IUserManager.Stub {
                    new AtomicFile(new File(mUsersDir, Integer.toString(id) + XML_SUFFIX));
                    new AtomicFile(new File(mUsersDir, Integer.toString(id) + XML_SUFFIX));
            fis = userFile.openRead();
            fis = userFile.openRead();
            return readUserLP(id, fis);
            return readUserLP(id, fis);
        } catch (IOException | XmlPullParserException e) {
        } catch (IOException ioe) {
            Slog.e(LOG_TAG, "Error reading user " + id + ": " + e);
            Slog.e(LOG_TAG, "Error reading user list");
        } catch (XmlPullParserException pe) {
            Slog.e(LOG_TAG, "Error reading user list");
        } finally {
        } finally {
            IoUtils.closeQuietly(fis);
            IoUtils.closeQuietly(fis);
        }
        }