Settings UI fix for missing secure lock screen feature.
Bug: 123737250 Bug: 111072170 Bug: 111071972 Test: manual both with and without the feature flag Test: make RunSettingsRoboTests Change-Id: Iacefa95dce85d860633315e074cbf2772691cfdd
This commit is contained in:
@@ -238,8 +238,8 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
UserManager.get(getActivity()),
|
||||
getArguments(),
|
||||
getActivity().getIntent().getExtras()).getIdentifier();
|
||||
mController =
|
||||
new ChooseLockGenericController(getContext(), mUserId, mRequestedMinComplexity);
|
||||
mController = new ChooseLockGenericController(
|
||||
getContext(), mUserId, mRequestedMinComplexity, mLockPatternUtils);
|
||||
if (ACTION_SET_NEW_PASSWORD.equals(chooseLockAction)
|
||||
&& UserManager.get(getActivity()).isManagedProfile(mUserId)
|
||||
&& mLockPatternUtils.isSeparateProfileChallengeEnabled(mUserId)) {
|
||||
|
@@ -27,6 +27,7 @@ import android.os.UserHandle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -43,12 +44,14 @@ public class ChooseLockGenericController {
|
||||
@PasswordComplexity private final int mRequestedMinComplexity;
|
||||
private ManagedLockPasswordProvider mManagedPasswordProvider;
|
||||
private DevicePolicyManager mDpm;
|
||||
private final LockPatternUtils mLockPatternUtils;
|
||||
|
||||
public ChooseLockGenericController(Context context, int userId) {
|
||||
this(
|
||||
context,
|
||||
userId,
|
||||
PASSWORD_COMPLEXITY_NONE);
|
||||
PASSWORD_COMPLEXITY_NONE,
|
||||
new LockPatternUtils(context));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,13 +59,14 @@ public class ChooseLockGenericController {
|
||||
* when determining the available screen lock types
|
||||
*/
|
||||
public ChooseLockGenericController(Context context, int userId,
|
||||
@PasswordComplexity int requestedMinComplexity) {
|
||||
@PasswordComplexity int requestedMinComplexity, LockPatternUtils lockPatternUtils) {
|
||||
this(
|
||||
context,
|
||||
userId,
|
||||
requestedMinComplexity,
|
||||
context.getSystemService(DevicePolicyManager.class),
|
||||
ManagedLockPasswordProvider.get(context, userId));
|
||||
ManagedLockPasswordProvider.get(context, userId),
|
||||
lockPatternUtils);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -71,12 +75,14 @@ public class ChooseLockGenericController {
|
||||
int userId,
|
||||
@PasswordComplexity int requestedMinComplexity,
|
||||
DevicePolicyManager dpm,
|
||||
ManagedLockPasswordProvider managedLockPasswordProvider) {
|
||||
ManagedLockPasswordProvider managedLockPasswordProvider,
|
||||
LockPatternUtils lockPatternUtils) {
|
||||
mContext = context;
|
||||
mUserId = userId;
|
||||
mRequestedMinComplexity = requestedMinComplexity;
|
||||
mManagedPasswordProvider = managedLockPasswordProvider;
|
||||
mDpm = dpm;
|
||||
mLockPatternUtils = lockPatternUtils;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,6 +111,12 @@ public class ChooseLockGenericController {
|
||||
&& !managedProfile; // Swipe doesn't make sense for profiles.
|
||||
case MANAGED:
|
||||
return mManagedPasswordProvider.isManagedPasswordChoosable();
|
||||
case PIN:
|
||||
case PATTERN:
|
||||
case PASSWORD:
|
||||
// Hide the secure lock screen options if the device doesn't support the secure lock
|
||||
// screen feature.
|
||||
return mLockPatternUtils.hasSecureLockScreen();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user