Failed guest creation doesn't crash Settings
In the new multiuser settings, there's no logic to handle what happens when a guest user creation fails, and so Settings crashed with a NullPointerException. In the fix, we catch this case to avoid crashing, and display a toast to the user so that they understand the operation was not successful. Bug: 175042193 Test: manually failed to create user and observe toast and no crash Change-Id: I7dfcaa1eb6d4b792946e18d1632fd2c75e93c168
This commit is contained in:
@@ -36,7 +36,6 @@ public class UserPreference extends RestrictedPreference {
|
||||
private static final int ALPHA_DISABLED = 102;
|
||||
|
||||
public static final int USERID_UNKNOWN = -10;
|
||||
public static final int USERID_GUEST_DEFAULTS = -11;
|
||||
public static final Comparator<UserPreference> SERIAL_NUMBER_COMPARATOR =
|
||||
(p1, p2) -> {
|
||||
|
||||
@@ -93,8 +92,6 @@ public class UserPreference extends RestrictedPreference {
|
||||
// If the userId is unknown
|
||||
if (mUserId == USERID_UNKNOWN) {
|
||||
return Integer.MAX_VALUE;
|
||||
} else if (mUserId == USERID_GUEST_DEFAULTS) {
|
||||
return Integer.MAX_VALUE - 1;
|
||||
}
|
||||
mSerialNumber = ((UserManager) getContext().getSystemService(Context.USER_SERVICE))
|
||||
.getUserSerialNumber(mUserId);
|
||||
|
Reference in New Issue
Block a user