Merge "Remove refs of isSeparateProfileChallengeAllowed"

This commit is contained in:
Ayush Sharma
2021-08-13 15:49:11 +00:00
committed by Android (Google) Code Review
10 changed files with 14 additions and 56 deletions

View File

@@ -39,7 +39,7 @@ public class BiometricFaceProfileStatusPreferenceController extends
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -39,7 +39,7 @@ public class BiometricFingerprintProfileStatusPreferenceController extends
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -52,7 +52,7 @@ public class CombinedBiometricProfileStatusPreferenceController extends
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -59,7 +59,7 @@ public class FaceProfileStatusPreferenceController extends FaceStatusPreferenceC
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -46,7 +46,7 @@ public class FingerprintProfileStatusPreferenceController
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -36,7 +36,6 @@ import android.os.UserManager;
import androidx.annotation.VisibleForTesting;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.Utils;
/**
@@ -68,17 +67,15 @@ final class SetNewPasswordController {
public static SetNewPasswordController create(Context context, Ui ui, Intent intent,
IBinder activityToken) {
// Trying to figure out which user is setting new password. If it is
// ACTION_SET_NEW_PARENT_PROFILE_PASSWORD or the calling user is not allowed to set
// separate profile challenge, it is the current user to set new password. Otherwise,
// it is the user who starts this activity setting new password.
int userId = ActivityManager.getCurrentUser();
// ACTION_SET_NEW_PARENT_PROFILE_PASSWORD, it is the current user to set
// new password. Otherwise, it is the user who starts this activity
// setting new password.
final int userId;
if (ACTION_SET_NEW_PASSWORD.equals(intent.getAction())) {
final int callingUserId = Utils.getSecureTargetUser(activityToken,
userId = Utils.getSecureTargetUser(activityToken,
UserManager.get(context), null, intent.getExtras()).getIdentifier();
final LockPatternUtils lockPatternUtils = new LockPatternUtils(context);
if (lockPatternUtils.isSeparateProfileChallengeAllowed(callingUserId)) {
userId = callingUserId;
}
} else {
userId = ActivityManager.getCurrentUser();
}
// Create a wrapper of FingerprintManager for testing, see IFingerPrintManager for details.
final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(context);

View File

@@ -52,7 +52,7 @@ public class ChangeProfileScreenLockPreferenceController extends
public boolean isAvailable() {
if (mProfileChallengeUserId == UserHandle.USER_NULL ||
!mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId)) {
!mUm.isManagedProfile(mProfileChallengeUserId)) {
return false;
}
if (!mLockPatternUtils.isSecure(mProfileChallengeUserId)) {

View File

@@ -107,7 +107,7 @@ public class LockUnificationPreferenceController extends AbstractPreferenceContr
@Override
public boolean isAvailable() {
return mProfileUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileUserId);
&& mUm.isManagedProfile(mProfileUserId);
}
@Override