Merge "Prevents showing Guests in switcher." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
027a967389
@@ -91,8 +91,12 @@ public class UserGridRecyclerView extends RecyclerView implements
|
||||
private List<UserRecord> createUserRecords(List<UserInfo> userInfoList) {
|
||||
List<UserRecord> userRecords = new ArrayList<>();
|
||||
for (UserInfo userInfo : userInfoList) {
|
||||
if (userInfo.isGuest()) {
|
||||
// Don't display guests in the switcher.
|
||||
continue;
|
||||
}
|
||||
boolean isForeground = mUserManagerHelper.getForegroundUserId() == userInfo.id;
|
||||
UserRecord record = new UserRecord(userInfo, false /* isGuest */,
|
||||
UserRecord record = new UserRecord(userInfo, false /* isStartGuestSession */,
|
||||
false /* isAddUser */, isForeground);
|
||||
userRecords.add(record);
|
||||
}
|
||||
@@ -116,7 +120,7 @@ public class UserGridRecyclerView extends RecyclerView implements
|
||||
private UserRecord addGuestUserRecord() {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.name = mContext.getString(R.string.car_guest);
|
||||
return new UserRecord(userInfo, true /* isGuest */,
|
||||
return new UserRecord(userInfo, true /* isStartGuestSession */,
|
||||
false /* isAddUser */, false /* isForeground */);
|
||||
}
|
||||
|
||||
@@ -126,7 +130,7 @@ public class UserGridRecyclerView extends RecyclerView implements
|
||||
private UserRecord addUserRecord() {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.name = mContext.getString(R.string.car_add_user);
|
||||
return new UserRecord(userInfo, false /* isGuest */,
|
||||
return new UserRecord(userInfo, false /* isStartGuestSession */,
|
||||
true /* isAddUser */, false /* isForeground */);
|
||||
}
|
||||
|
||||
@@ -198,8 +202,8 @@ public class UserGridRecyclerView extends RecyclerView implements
|
||||
mUserSelectionListener.onUserSelected(userRecord);
|
||||
}
|
||||
|
||||
// If the user selects Guest, switch to Guest profile
|
||||
if (userRecord.mIsGuest) {
|
||||
// If the user selects Guest, start the guest session.
|
||||
if (userRecord.mIsStartGuestSession) {
|
||||
mUserManagerHelper.switchToGuest(mGuestName);
|
||||
return;
|
||||
}
|
||||
@@ -313,14 +317,14 @@ public class UserGridRecyclerView extends RecyclerView implements
|
||||
public static final class UserRecord {
|
||||
|
||||
public final UserInfo mInfo;
|
||||
public final boolean mIsGuest;
|
||||
public final boolean mIsStartGuestSession;
|
||||
public final boolean mIsAddUser;
|
||||
public final boolean mIsForeground;
|
||||
|
||||
public UserRecord(UserInfo userInfo, boolean isGuest, boolean isAddUser,
|
||||
public UserRecord(UserInfo userInfo, boolean isStartGuestSession, boolean isAddUser,
|
||||
boolean isForeground) {
|
||||
mInfo = userInfo;
|
||||
mIsGuest = isGuest;
|
||||
mIsStartGuestSession = isStartGuestSession;
|
||||
mIsAddUser = isAddUser;
|
||||
mIsForeground = isForeground;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user