Keyguard should be dismissed if there is no trusted device.
The only times the keyguard is shown are: 1. To display unlock dialog when the initial user has a trusted device. 2. To display user switcher if the user clicks "Cancel" on the bouncer and wants to switch to a different user. Fixes: 140766764 Test: manual Change-Id: I9e3c1138813ba40f0c6b2e8cba057b99ff6fb040
This commit is contained in:
committed by
Ram Periathiruvadi
parent
4075dff405
commit
ff3328346d
@@ -50,9 +50,6 @@ import javax.inject.Singleton;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class FullscreenUserSwitcher {
|
public class FullscreenUserSwitcher {
|
||||||
private static final String TAG = FullscreenUserSwitcher.class.getSimpleName();
|
private static final String TAG = FullscreenUserSwitcher.class.getSimpleName();
|
||||||
// Because user 0 is headless, user count for single user is 2
|
|
||||||
private static final int NUMBER_OF_BACKGROUND_USERS = 1;
|
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final Resources mResources;
|
private final Resources mResources;
|
||||||
private final UserManager mUserManager;
|
private final UserManager mUserManager;
|
||||||
@@ -137,26 +134,17 @@ public class FullscreenUserSwitcher {
|
|||||||
/* isStartGuestSession= */ false,
|
/* isStartGuestSession= */ false,
|
||||||
/* isAddUser= */ false,
|
/* isAddUser= */ false,
|
||||||
/* isForeground= */ true);
|
/* isForeground= */ true);
|
||||||
// For single user without trusted device, hide the user switcher.
|
|
||||||
if (!hasMultipleUsers() && !hasTrustedDevice(initialUser)) {
|
// If the initial user has trusted device, display the unlock dialog on the keyguard.
|
||||||
dismissUserSwitcher();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Show unlock dialog for initial user
|
|
||||||
if (hasTrustedDevice(initialUser)) {
|
if (hasTrustedDevice(initialUser)) {
|
||||||
mUnlockDialogHelper.showUnlockDialogAfterDelay(initialUser,
|
mUnlockDialogHelper.showUnlockDialogAfterDelay(initialUser,
|
||||||
mOnHideListener);
|
mOnHideListener);
|
||||||
|
} else {
|
||||||
|
// If no trusted device, dismiss the keyguard.
|
||||||
|
dismissUserSwitcher();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if there is only one possible user to login in.
|
|
||||||
* In a Multi-User system there is always one background user (user 0)
|
|
||||||
*/
|
|
||||||
private boolean hasMultipleUsers() {
|
|
||||||
return mUserManager.getUserCount() > NUMBER_OF_BACKGROUND_USERS + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes user grid visible.
|
* Makes user grid visible.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user